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.


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


// 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.


Since 3.4.0 Introduced.

WP_Object_Cache::_exists() code WP 6.4.1

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