You are here

public function TomeStaticSuperCacheTagsInvalidator::invalidateTags in Tome 8

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 CacheTagsInvalidator::invalidateTags

File

modules/tome_static/modules/tome_static_super_cache/src/TomeStaticSuperCacheTagsInvalidator.php, line 15

Class

TomeStaticSuperCacheTagsInvalidator
Decorates the core cache tags invalidator to ignore certain tags.

Namespace

Drupal\tome_static_super_cache

Code

public function invalidateTags(array $tags) {
  if (!isset($GLOBALS[SuperStaticCache::FULL_REBUILD_KEY]) && isset($GLOBALS[SuperStaticCache::REBUILD_KEY])) {
    $skip_tags = [
      'http_response',
      'local_task',
    ];
    foreach ($tags as $i => $tag) {
      if (strpos($tag, 'config:system.menu') === 0 || in_array($tag, $skip_tags, TRUE)) {
        unset($tags[$i]);
      }
    }
  }
  if (!empty($tags)) {
    parent::invalidateTags($tags);
  }
}