WP_Object_Cache::delete
Removes the contents of the cache key in the group.
If the cache key does not exist in the group, then nothing will happen.
Method of the class: WP_Object_Cache{}
No Hooks.
Returns
true|false. True on success, false if the contents were not deleted.
Usage
$WP_Object_Cache = new WP_Object_Cache(); $WP_Object_Cache->delete( $key, $group, $deprecated );
- $key(int|string) (required)
- What the contents in the cache are called.
- $group(string)
- Where the cache contents are grouped.
Default: 'default' - $deprecated(true|false)
- Unused.
Default: false
Changelog
| Since 2.0.0 | Introduced. |
WP_Object_Cache::delete() WP Object Cache::delete code WP 6.8.3
public function delete( $key, $group = 'default', $deprecated = false ) {
if ( ! $this->is_valid_key( $key ) ) {
return false;
}
if ( empty( $group ) ) {
$group = 'default';
}
if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {
$key = $this->blog_prefix . $key;
}
if ( ! $this->_exists( $key, $group ) ) {
return false;
}
unset( $this->cache[ $group ][ $key ] );
return true;
}