WP_Object_Cache::delete

Advertisement

Summery Summery

Removes the contents of the cache key in the group.

Syntax Syntax

WP_Object_Cache::delete( int|string $key, string $group = 'default', bool $deprecated = false )

Description Description

If the cache key does not exist in the group, then nothing will happen.

Parameters Parameters

$key

(Required) What the contents in the cache are called.

$group

(Optional) Where the cache contents are grouped. Default 'default'.

Default value: 'default'

$deprecated

(Optional) Unused.

Default value: false

Return Return

(bool) False if the contents weren't deleted and true on success.

Source Source

File: wp-includes/class-wp-object-cache.php

	public function delete( $key, $group = 'default', $deprecated = 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;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Advertisement

Leave a Reply