Automattic\WooCommerce\Admin\API\Reports

DataStore::get_cached_data()protectedWC 1.0

Wrapper around Cache::get().

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

Хуков нет.

Возвращает

Разное.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_cached_data( $cache_key );
$cache_key(строка) (обязательный)
Cache key.

Код DataStore::get_cached_data() WC 8.7.0

protected function get_cached_data( $cache_key ) {
	if ( true === $this->debug_cache ) {
		$this->debug_cache_data['should_use_cache']    = $this->should_use_cache();
		$this->debug_cache_data['force_cache_refresh'] = $this->force_cache_refresh;
		$this->debug_cache_data['cache_hit']           = false;
	}

	if ( $this->should_use_cache() && false === $this->force_cache_refresh ) {
		$cached_data = Cache::get( $cache_key );

		$cache_hit = false !== $cached_data;
		if ( true === $this->debug_cache ) {
			$this->debug_cache_data['cache_hit'] = $cache_hit;
		}

		return $cached_data;
	}

	// Cached item has now functionally been refreshed. Reset the option.
	$this->force_cache_refresh = false;

	return false;
}