Automattic\WooCommerce\Caches
ProductCountCacheService::prime_cache_if_cold
Primes the product count cache for a given post type when it is cold.
Метод класса: ProductCountCacheService{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$ProductCountCacheService = new ProductCountCacheService(); $ProductCountCacheService->prime_cache_if_cold( $product_type ): void;
- $product_type(строка)
- The product post type.
По умолчанию:'product'
Код ProductCountCacheService::prime_cache_if_cold() ProductCountCacheService::prime cache if cold WC 11.2.2
public function prime_cache_if_cold( string $product_type = 'product' ): void {
// 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->product_count_cache->get( $product_type ) ) {
$this->product_count_cache->flush( $product_type );
wc_get_container()->get( ProductUtil::class )->get_counts_for_type( $product_type );
}
}