You are here

public function VariationCache::invalidate in VariationCache 8

Marks a cache item as invalid.

To stay consistent with ::get(), this only affects the active variation, not all possible variations for the associated cache contexts.

Parameters

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

\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.

Overrides VariationCacheInterface::invalidate

See also

\Drupal\Core\Cache\CacheBackendInterface::invalidate()

File

src/Cache/VariationCache.php, line 173

Class

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

Namespace

Drupal\variationcache\Cache

Code

public function invalidate(array $keys, CacheableDependencyInterface $initial_cacheability) {
  $chain = $this
    ->getRedirectChain($keys, $initial_cacheability);
  end($chain);
  $this->cacheBackend
    ->invalidate(key($chain));
}