Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. VariationCache.php

function VariationCache::createCacheIdFast

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 optimization 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 core/lib/Drupal/Core/Cache/VariationCache.php
Performs a full get, returning every step of the way.
VariationCache::set in core/lib/Drupal/Core/Cache/VariationCache.php
Stores data in the cache.

File

core/lib/Drupal/Core/Cache/VariationCache.php, line 284

Class

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

Namespace

Drupal\Core\Cache

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal