Automattic\WooCommerce\Caching

WPCacheEngine::get_cached_objectpublicWC 1.0

Retrieves an object cached under a given key.

Method of the class: WPCacheEngine{}

No Hooks.

Returns

Array|Object|null. The cached object, or null if there's no object cached under the passed key.

Usage

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

WPCacheEngine::get_cached_object() code WC 10.8.1

public function get_cached_object( string $key, string $group = '' ) {
	$prefixed_key = self::get_prefixed_key( $key, $group );
	$value        = wp_cache_get( $prefixed_key, $group );
	return false === $value ? null : $value;
}