Automattic\WooCommerce\Internal\ComingSoon

ComingSoonCacheInvalidator::invalidate_caches()publicWC 1.0

Invalidate the WordPress object cache and other known caches.

Метод класса: ComingSoonCacheInvalidator{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ComingSoonCacheInvalidator = new ComingSoonCacheInvalidator();
$ComingSoonCacheInvalidator->invalidate_caches();

Код ComingSoonCacheInvalidator::invalidate_caches() WC 9.7.1

public function invalidate_caches() {
	// Standard WordPress object cache invalidation.
	wp_cache_flush();

	/**
	 * Temporary solution to invalidate the WordPress.com Edge Cache. We can trigger
	 * invalidation by publishing any post. It should be refactored with a supported integration.
	 */
	$cart_page_id = get_option( 'woocommerce_cart_page_id' ) ?? null;
	if ( $cart_page_id ) {
		// Re-publish the coming soon page. Has the side-effect of invalidating the Edge Cache.
		wp_update_post(
			array(
				'ID'          => $cart_page_id,
				'post_status' => 'publish',
			)
		);
	}
}