function LruMemoryCache::invalidateTags

Same name and namespace in other branches
  1. main core/lib/Drupal/Core/Cache/MemoryCache/LruMemoryCache.php \Drupal\Core\Cache\MemoryCache\LruMemoryCache::invalidateTags()

Overrides MemoryBackend::invalidateTags

File

core/lib/Drupal/Core/Cache/MemoryCache/LruMemoryCache.php, line 115

Class

LruMemoryCache
Defines a least recently used (LRU) static cache implementation.

Namespace

Drupal\Core\Cache\MemoryCache

Code

public function invalidateTags(array $tags) : void {
  // Remove items when tags are invalidated so that memory is freed
  // immediately.
  foreach ($this->cache as $cid => $item) {
    if (array_intersect($tags, $item->tags)) {
      unset($this->cache[$cid]);
    }
  }
}

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