Automattic\WooCommerce\Internal\Caches

ProductCacheController::initpublicWC 10.5.0

Class initialization, invoked by the DI container.

Method of the class: ProductCacheController{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ProductCacheController = new ProductCacheController();
$ProductCacheController->init( $product_cache ): void;
$product_cache(ProductCache) (required)
The product cache instance.

Changelog

Since 10.5.0 Introduced.

ProductCacheController::init() code WC 10.7.0

final public function init( ProductCache $product_cache ): void {
	$this->product_cache = $product_cache;

	// Mark cache group as non-persistent immediately to ensure it's set
	// regardless of when this controller is instantiated relative to other hooks.
	$this->set_product_cache_group_as_non_persistent();

	// Defer feature check to 'init' to avoid triggering translations too early.
	add_action( 'init', array( $this, 'on_init' ), 0 );
}