function VariationCache::getRedirectChain

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Cache/VariationCache.php \Drupal\Core\Cache\VariationCache::getRedirectChain()

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 core/lib/Drupal/Core/Cache/VariationCache.php
Deletes an item from the cache.
VariationCache::get in core/lib/Drupal/Core/Cache/VariationCache.php
Gets a cache entry based on cache keys.
VariationCache::invalidate in core/lib/Drupal/Core/Cache/VariationCache.php
Marks a cache item as invalid.
VariationCache::set in core/lib/Drupal/Core/Cache/VariationCache.php
Stores data in the cache.

File

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

Class

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

Namespace

Drupal\Core\Cache

Code

protected function getRedirectChain(array $keys, CacheableDependencyInterface $initial_cacheability) : array {
    $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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.