You are here

public function RedirectSettingsCacheTag::onSave in Redirect 8

Invalidate the 'rendered' cache tag whenever the settings are modified.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The Event to process.

File

src/EventSubscriber/RedirectSettingsCacheTag.php, line 38

Class

RedirectSettingsCacheTag
A subscriber invalidating the 'rendered' cache tag when saving redirect settings.

Namespace

Drupal\redirect\EventSubscriber

Code

public function onSave(ConfigCrudEvent $event) {

  // Changing the Redirect settings means that any cached page might
  // result in a different response, so we need to invalidate them all.
  if ($event
    ->getConfig()
    ->getName() === 'redirect.settings') {
    $this->cacheTagsInvalidator
      ->invalidateTags([
      'rendered',
    ]);
  }
}