Skip to content

ConfigCacheTagInvalidator

A subscriber for invalidating cache tags when a config object is saved.


  • Full name: \Drupal\helper\EventSubscriber\ConfigCacheTagInvalidator
  • This class implements: EventSubscriberInterface

Properties

cacheTagsInvalidator

The cache tags invalidator.

protected \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cacheTagsInvalidator

configName

The configuration object name.

protected string $configName

cacheTags

The cache tags to invalidate when the configuration object is changed.

protected array $cacheTags

Methods

__construct

Constructs a ConfigCacheTagInvalidator object.

public __construct(\Drupal\Core\Cache\CacheTagsInvalidatorInterface $cache_tags_invalidator, string $config_name, array $cache_tags): mixed

Parameters:

Parameter Type Description
$cache_tags_invalidator \Drupal\Core\Cache\CacheTagsInvalidatorInterface
The cache tags invalidator.
$config_name string
The configuration object name.
$cache_tags array
The cache tags to invalidate when the configuration object is changed.

onChange

Invalidate the cache tags whenever the config is changed.

public onChange(\Drupal\Core\Config\ConfigCrudEvent $event): mixed

Parameters:

Parameter Type Description
$event \Drupal\Core\Config\ConfigCrudEvent
The configuration event to process.

getSubscribedEvents

{@inheritdoc}

public static getSubscribedEvents(): array
  • This method is static.