Automattic\WooCommerce\Caches

ProductCountCache::setpublicWC 1.0

Set the cache value for a given product type and status.

Method of the class: ProductCountCache{}

No Hooks.

Returns

true|false.

Usage

$ProductCountCache = new ProductCountCache();
$ProductCountCache->set( $product_type, $product_status, $value ): bool;
$product_type(string) (required)
The post type (e.g. 'product', 'product_variation').
$product_status(string) (required)
The status slug of the product.
$value(int) (required)
The value to set.

ProductCountCache::set() code WC 11.0.0

public function set( string $product_type, string $product_status, int $value ): bool {
	$this->ensure_statuses_for_type( $product_type, array( $product_status ) );
	return wp_cache_set( $this->get_cache_key( $product_type, $product_status ), $value, '', $this->expiration );
}