Automattic\WooCommerce\Internal\Caches

ProductCacheController::set_product_cache_group_as_non_persistentpublicWC 10.5.0

Set the product_objects cache group as non-persistent.

With product instance caching enabled, products are cached in-memory during a request rather than being persisted to external cache backends. If WC_Data::__sleep()/::__wakeup() methods are eventually removed or changed so that the entire object is stored instead of just the ID, this should be revisited and evaluated performance impact.

Method of the class: ProductCacheController{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ProductCacheController = new ProductCacheController();
$ProductCacheController->set_product_cache_group_as_non_persistent(): void;

Changelog

Since 10.5.0 Introduced.

ProductCacheController::set_product_cache_group_as_non_persistent() code WC 10.7.0

public function set_product_cache_group_as_non_persistent(): void {
	wp_cache_add_non_persistent_groups( array( $this->product_cache->get_object_type() ) );
}