Automattic\WooCommerce\Caches
ProductCountCacheService::init
Class initialization, invoked by the DI container.
Method of the class: ProductCountCacheService{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ProductCountCacheService = new ProductCountCacheService(); $ProductCountCacheService->init(): void;
ProductCountCacheService::init() ProductCountCacheService::init code WC 11.1.2
final public function init(): void {
$this->product_count_cache = new ProductCountCache();
add_action( 'action_scheduler_ensure_recurring_actions', array( $this, 'schedule_background_actions' ) );
add_action( self::BACKGROUND_EVENT_HOOK, array( $this, 'prime_cache_if_cold' ) );
if ( defined( 'WC_PLUGIN_BASENAME' ) ) {
add_action( 'deactivate_' . WC_PLUGIN_BASENAME, array( $this, 'unschedule_background_actions' ) );
}
// transition_post_status owns all mid-lifecycle status changes; woocommerce_new_product corrects for creation-time
// ephemeral transitions before the final status is committed; before_delete_post closes the lifecycle.
add_action( 'transition_post_status', array( $this, 'update_on_product_status_changed' ), 10, 3 );
add_action( 'before_delete_post', array( $this, 'update_on_product_deleted' ), 10, 2 );
}