WPCacheEngine::cache_object()publicWC 1.0

Caches an object under a given key, and with a given expiration.

Метод класса: WPCacheEngine{}

Хуков нет.


true|false. True if the object is cached successfully, false otherwise.


$WPCacheEngine = new WPCacheEngine();
$WPCacheEngine->cache_object( $key, $object, $expiration, $group ): bool;
$key(строка) (обязательный)
The key under which the object will be cached.
$object(массив|объект) (обязательный)
The object to cache.
$expiration(int) (обязательный)
Expiration for the cached object, in seconds.
The group under which the object will be cached.
По умолчанию: ''

Код WPCacheEngine::cache_object() WC 7.7.2

public function cache_object( string $key, $object, int $expiration, string $group = '' ): bool {
	$prefixed_key = self::get_prefixed_key( $key, $group );
	return wp_cache_set( $prefixed_key, $object, $group, $expiration );