You are here

protected function VariationCache::createCacheIdFast in VariationCache 8

Creates a cache ID based on cache keys and cacheable metadata.

This is a simpler, faster version of ::createCacheID() to be used when you do not care about how cache context folding affects the cache tags.

Parameters

string[] $keys: The cache keys of the data to store.

\Drupal\Core\Cache\CacheableDependencyInterface $cacheability: The cache metadata of the data to store.

Return value

string The cache ID for the redirect.

2 calls to VariationCache::createCacheIdFast()
VariationCache::getRedirectChain in src/Cache/VariationCache.php
Performs a full get, returning every step of the way.
VariationCache::set in src/Cache/VariationCache.php
Stores data in the cache.

File

src/Cache/VariationCache.php, line 264

Class

VariationCache
Wraps a regular cache backend to make it support cache contexts.

Namespace

Drupal\variationcache\Cache

Code

protected function createCacheIdFast(array $keys, CacheableDependencyInterface $cacheability) {
  if ($contexts = $cacheability
    ->getCacheContexts()) {
    $context_cache_keys = $this->cacheContextsManager
      ->convertTokensToKeys($cacheability
      ->getCacheContexts());
    $keys = array_merge($keys, $context_cache_keys
      ->getKeys());
  }
  return implode(':', $keys);
}