Automattic\WooCommerce\Caching
WPCacheEngine::cache_objects
Caches an object under a given key, and with a given expiration.
Метод класса: WPCacheEngine{}
Хуков нет.
Возвращает
Массив. Array of return values, grouped by key. Each value is either true on success, or false on failure
Использование
$WPCacheEngine = new WPCacheEngine(); $WPCacheEngine->cache_objects( $objects, $expiration, $group ): array;
- $objects(массив) (обязательный)
- The objects to cache keyed by the key to cache under.
- $expiration(int) (обязательный)
- Expiration for the cached object, in seconds.
- $group(строка)
- The group under which the object will be cached.
По умолчанию:''
Код WPCacheEngine::cache_objects() WPCacheEngine::cache objects WC 10.9.4
public function cache_objects( array $objects, int $expiration, string $group = '' ): array {
$prefix = self::get_cache_prefix( $group );
$objects = array_combine(
array_map(
function ( $key ) use ( $prefix ) {
return $prefix . $key;
},
array_keys( $objects )
),
$objects,
);
return wp_cache_set_multiple( $objects, $group, $expiration );
}