CacheRouterRebuildSubscriber.php in Drupal 9
File
core/lib/Drupal/Core/EventSubscriber/CacheRouterRebuildSubscriber.php
View source
<?php
namespace Drupal\Core\EventSubscriber;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Routing\RoutingEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CacheRouterRebuildSubscriber implements EventSubscriberInterface {
public function onRouterFinished() {
Cache::invalidateTags([
'4xx-response',
'route_match',
'http_response',
]);
}
public static function getSubscribedEvents() {
$events = [];
$events[RoutingEvents::FINISHED][] = [
'onRouterFinished',
200,
];
return $events;
}
}