ObjectCache::create_cache_key_prefix()privateWC 1.0

Generate a prefix for the cache keys to use, containing the object type and a random string, and store it persistently using an option.

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

No Hooks.


String. The generated prefix.


// private - for code of main (parent) class only
$result = $this->create_cache_key_prefix(): string;

Code of ObjectCache::create_cache_key_prefix() WC 7.1.0

private function create_cache_key_prefix(): string {
	$prefix_variable_part = $this->get_random_string();
	$prefix               = "woocommerce_object_cache|{$this->object_type}|{$prefix_variable_part}|";
	if ( ! update_option( $this->cache_key_prefix_option_name, $prefix ) ) {
		throw new CacheException( "Can't store the key prefix option", $this );
	return $prefix;