Automattic\WooCommerce\Caching

ObjectCache::remove()publicWC 1.0

Remove an object from the cache.

{} It's a method of the class: ObjectCache{}

Return

true|false. True if the object is removed from the cache successfully, false otherwise (because the object wasn't cached or for other reason).

Usage

$ObjectCache = new ObjectCache();
$ObjectCache->remove( $id ): bool;
$id(int|string) (required)
The id of the object to remove.

Code of ObjectCache::remove() WC 7.1.0

public function remove( $id ): bool {
	$result = $this->get_cache_engine()->delete_cached_object( $this->get_cache_key_prefix() . $id );

	/**
	 * Action triggered by an instance of ObjectCache after an object is (attempted to be) removed from the cache.
	 *
	 * @since 6.8.0
	 *
	 * @param int|string $id The id of the object being removed.
	 * @param bool $result True if the object removal succeeded, false otherwise.
	 */
	do_action( "woocommerce_after_removing_{$this->object_type}_from_cache", $id, $result );

	return $result;
}