You are here

public function CacheCacheTagsChecksum::invalidateTags in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/CacheCacheTagsChecksum.php \Drupal\supercache\Cache\CacheCacheTagsChecksum::invalidateTags()

Marks cache items with any of the specified tags as invalid.

Parameters

string[] $tags: The list of tags for which to invalidate cache items.

Overrides CacheTagsInvalidatorInterface::invalidateTags

File

src/Cache/CacheCacheTagsChecksum.php, line 56
Contains \Drupal\supercache\Cache\CacheCacheTagsChecksum.

Class

CacheCacheTagsChecksum
Cache tags invalidations checksum implementation that uses a CacheRawBackendInterface as the storage.

Namespace

Drupal\supercache\Cache

Code

public function invalidateTags(array $tags) {
  $tags_to_invalidate = [];
  foreach ($tags as $tag) {

    // Only invalidate tags once per request unless they are written again.
    if (isset($this->invalidatedTags[$tag])) {
      unset($tags[$tag]);
      continue;
    }
    $this->invalidatedTags[$tag] = TRUE;
    unset($this->tagCache[$tag]);
    $tags_to_invalidate[] = $tag;
  }

  // Some cache backends are very efficient at doing
  // batch counters in a single statement.
  $this->backend
    ->counterMultiple($tags_to_invalidate, 1);
}