WP_Object_Cache::_exists() WordPress Method

The WP_Object_Cache::_exists() method is a private method used to check if a given key exists in the cache. This is a helper method used by the public methods such as get(), set(), and add().

WP_Object_Cache::_exists( int|string $key, string $group ) #

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


Parameters

$key

(int|string)(Required)Cache key to check for existence.

$group

(string)(Required)Cache group for the key existence check.


Top ↑

Return

(bool) Whether the key exists in the cache for the given group.


Top ↑

Source

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

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


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.