Automattic\WooCommerce\Caches

OrderCountCacheService::prime_cache_if_coldpublicWC 10.7.0

Keeps the cache warm for a specific order type to maintain admin performance, especially after extended periods of inactivity or when the cache has been cleared.

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

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$OrderCountCacheService = new OrderCountCacheService();
$OrderCountCacheService->prime_cache_if_cold( $order_type );
$order_type(строка) (обязательный)
The order type.

Список изменений

С версии 10.7.0 Введена.

Код OrderCountCacheService::prime_cache_if_cold() WC 10.9.4

public function prime_cache_if_cold( $order_type ) {
	// Cache warm-up is only effective when an object cache plugin is active, and the cache entry is missing.
	if ( wp_using_ext_object_cache() && null === $this->order_count_cache->get( $order_type ) ) {
		$this->order_count_cache->flush( $order_type );
		OrderUtil::get_count_for_type( $order_type );
	}
}