Automattic\WooCommerce\Caches

OrderCountCacheService::initpublicWC 1.0

Class initialization, invoked by the DI container.

Method of the class: OrderCountCacheService{}

No Hooks.

Returns

null. Nothing (null).

Usage

$OrderCountCacheService = new OrderCountCacheService();
$OrderCountCacheService->init();

OrderCountCacheService::init() code WC 10.8.1

final public function init() {
	$this->order_count_cache = new OrderCountCache();
	add_action( 'woocommerce_new_order', array( $this, 'update_on_new_order' ), 10, 2 );
	add_action( 'woocommerce_order_status_changed', array( $this, 'update_on_order_status_changed' ), 10, 4 );
	add_action( 'woocommerce_before_trash_order', array( $this, 'update_on_order_trashed' ), 10, 2 );
	add_action( 'woocommerce_before_delete_order', array( $this, 'update_on_order_deleted' ), 10, 2 );
	add_action( self::BACKGROUND_EVENT_HOOK, array( $this, 'prime_cache_if_cold' ) );
	add_action( 'action_scheduler_ensure_recurring_actions', array( $this, 'schedule_background_actions' ) );

	if ( defined( 'WC_PLUGIN_BASENAME' ) ) {
		add_action( 'deactivate_' . WC_PLUGIN_BASENAME, array( $this, 'unschedule_background_actions' ) );
	}
}