protected function VariationCache::createCacheId in VariationCache 8
Creates a cache ID based on cache keys and cacheable metadata.
If cache contexts are folded during the creating of the cache ID, then the effect of said folding on the cache contexts will be reflected in the provided cacheable metadata.
Parameters
string[] $keys: The cache keys of the data to store.
\Drupal\Core\Cache\CacheableMetadata $cacheable_metadata: The cacheable metadata of the data to store.
Return value
string The cache ID.
1 call to VariationCache::createCacheId()
- VariationCache::set in src/
Cache/ VariationCache.php - Stores data in the cache.
File
- src/
Cache/ VariationCache.php, line 241
Class
- VariationCache
- Wraps a regular cache backend to make it support cache contexts.
Namespace
Drupal\variationcache\CacheCode
protected function createCacheId(array $keys, CacheableMetadata &$cacheable_metadata) {
if ($contexts = $cacheable_metadata
->getCacheContexts()) {
$context_cache_keys = $this->cacheContextsManager
->convertTokensToKeys($cacheable_metadata
->getCacheContexts());
$keys = array_merge($keys, $context_cache_keys
->getKeys());
$cacheable_metadata = $cacheable_metadata
->merge($context_cache_keys);
}
return implode(':', $keys);
}