Automattic\WooCommerce\Internal\ProductFeed\Utils

MemoryManager::flush_cachespublicWC 10.5.0

Flush all caches.

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

Хуков нет.

Возвращает

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

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

$MemoryManager = new MemoryManager();
$MemoryManager->flush_caches(): void;

Список изменений

С версии 10.5.0 Введена.

Код MemoryManager::flush_caches() WC 10.5.2

public function flush_caches(): void {
	global $wpdb, $wp_object_cache;

	$wpdb->queries = array();

	wp_cache_flush();

	if ( ! is_object( $wp_object_cache ) ) {
		return;
	}

	// These properties exist on various object cache implementations.
	$wp_object_cache->group_ops      = array(); // @phpstan-ignore property.notFound
	$wp_object_cache->stats          = array(); // @phpstan-ignore property.notFound
	$wp_object_cache->memcache_debug = array(); // @phpstan-ignore property.notFound
	$wp_object_cache->cache          = array(); // @phpstan-ignore property.notFound

	// This method is specific to certain memcached implementations.
	if ( method_exists( $wp_object_cache, '__remoteset' ) ) {
		$wp_object_cache->__remoteset(); // important.
	}

	$this->collect_garbage();
}