WP_Object_Cache::_exists()protectedWP 3.4.0

Serves as a utility function to determine whether a key exists in the cache.

Method of the class: WP_Object_Cache{}

No Hooks.

Return

true|false. Whether the key exists in the cache for the given group.

Usage

// protected - for code of main (parent) or child class
$result = $this->_exists( $key, $group );
$key(int|string) (required)
Cache key to check for existence.
$group(string) (required)
Cache group for the key existence check.

Changelog

Since 3.4.0 Introduced.

WP_Object_Cache::_exists() code WP 6.5.2

protected function _exists( $key, $group ) {
	return isset( $this->cache[ $group ] ) && ( isset( $this->cache[ $group ][ $key ] ) || array_key_exists( $key, $this->cache[ $group ] ) );
}