You are here

class TomeStaticSuperCacheTagsInvalidator in Tome 8

Decorates the core cache tags invalidator to ignore certain tags.

Hierarchy

Expanded class hierarchy of TomeStaticSuperCacheTagsInvalidator

1 string reference to 'TomeStaticSuperCacheTagsInvalidator'
tome_static_super_cache.services.yml in modules/tome_static/modules/tome_static_super_cache/tome_static_super_cache.services.yml
modules/tome_static/modules/tome_static_super_cache/tome_static_super_cache.services.yml
1 service uses TomeStaticSuperCacheTagsInvalidator
tome_static_super_cache.cache_tags.invalidator in modules/tome_static/modules/tome_static_super_cache/tome_static_super_cache.services.yml
Drupal\tome_static_super_cache\TomeStaticSuperCacheTagsInvalidator

File

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

Namespace

Drupal\tome_static_super_cache
View source
class TomeStaticSuperCacheTagsInvalidator extends CacheTagsInvalidator {

  /**
   * {@inheritdoc}
   */
  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);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheTagsInvalidator::$invalidators protected property Holds an array of cache tags invalidators.
CacheTagsInvalidator::addInvalidator public function Adds a cache tags invalidator.
CacheTagsInvalidator::getInvalidatorCacheBins protected function Returns all cache bins that need to be notified about invalidations.
CacheTagsInvalidator::resetChecksums public function Reset statically cached tags in all cache tag checksum services.
TomeStaticSuperCacheTagsInvalidator::invalidateTags public function Marks cache items with any of the specified tags as invalid. Overrides CacheTagsInvalidator::invalidateTags