You are here

protected function VariationCache::getRedirectChain in VariationCache 8

Performs a full get, returning every step of the way.

This will check whether there is a cache redirect and follow it if so. It will keep following redirects until it gets to a cache miss or the actual cache object.

Parameters

string[] $keys: The cache keys to retrieve the cache entry for.

\Drupal\Core\Cache\CacheableDependencyInterface $initial_cacheability: The cache metadata of the data to store before other systems had a chance to adjust it. This is also commonly known as "pre-bubbling" cacheability.

Return value

array Every cache get that lead to the final result, keyed by the cache ID used to query the cache for that result.

4 calls to VariationCache::getRedirectChain()
VariationCache::delete in src/Cache/VariationCache.php
Deletes an item from the cache.
VariationCache::get in src/Cache/VariationCache.php
Gets a cache entry based on cache keys.
VariationCache::invalidate in src/Cache/VariationCache.php
Marks a cache item as invalid.
VariationCache::set in src/Cache/VariationCache.php
Stores data in the cache.

File

src/Cache/VariationCache.php, line 196

Class

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

Namespace

Drupal\variationcache\Cache

Code

protected function getRedirectChain(array $keys, CacheableDependencyInterface $initial_cacheability) {
  $cid = $this
    ->createCacheIdFast($keys, $initial_cacheability);
  $chain[$cid] = $result = $this->cacheBackend
    ->get($cid);
  while ($result && $result->data instanceof CacheRedirect) {
    $cid = $this
      ->createCacheIdFast($keys, $result->data);
    $chain[$cid] = $result = $this->cacheBackend
      ->get($cid);
  }
  return $chain;
}