Automattic\WooCommerce\Caching

WPCacheEngine::is_cached()publicWC 1.0

Checks if an object is cached under a given key.

Method of the class: WPCacheEngine{}

No Hooks.

Return

true|false. True if there's an object cached under the given key, false otherwise.

Usage

$WPCacheEngine = new WPCacheEngine();
$WPCacheEngine->is_cached( $key, $group ): bool;
$key(string) (required)
The key to verify.
$group(string)
The group under which the object is cached.
Default: ''

WPCacheEngine::is_cached() code WC 9.4.2

public function is_cached( string $key, string $group = '' ): bool {
	$prefixed_key = self::get_prefixed_key( $key, $group );
	return false !== wp_cache_get( $prefixed_key, $group );
}