You are here

public function VarnishBackend::invalidateTags in Varnish 8

File

src/Cache/VarnishBackend.php, line 105

Class

VarnishBackend

Namespace

Drupal\varnish\Cache

Code

public function invalidateTags(array $tags) {
  $tag_cache =& drupal_static('Drupal\\Core\\Cache\\CacheBackendInterface::tagCache', []);
  $invalidated_tags =& drupal_static('Drupal\\Core\\Cache\\DatabaseBackend::invalidatedTags', []);
  foreach ($tags as $tag) {

    // Only invalidate tags once per request unless they are written again.
    if (isset($invalidated_tags[$tag])) {
      continue;
    }
    $invalidated_tags[$tag] = TRUE;
    unset($tag_cache[$tag]);
  }
}