class CacheTagPreloadSubscriber
Preloads frequently used cache tags.
Hierarchy
- class \Drupal\Core\Cache\EventSubscriber\CacheTagPreloadSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of CacheTagPreloadSubscriber
1 string reference to 'CacheTagPreloadSubscriber'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses CacheTagPreloadSubscriber
File
-
core/
lib/ Drupal/ Core/ Cache/ EventSubscriber/ CacheTagPreloadSubscriber.php, line 15
Namespace
Drupal\Core\Cache\EventSubscriberView source
class CacheTagPreloadSubscriber implements EventSubscriberInterface {
public function __construct(protected CacheTagsChecksumInterface $cacheTagsChecksum) {
}
/**
* Preloads frequently used cache tags.
*
* @param \Symfony\Component\HttpKernel\Event\RequestEvent $event
* The request event.
*/
public function onRequest(RequestEvent $event) : void {
if ($event->isMainRequest() && $this->cacheTagsChecksum instanceof CacheTagsChecksumPreloadInterface) {
$default_preload_cache_tags = array_merge([
'route_match',
'access_policies',
'routes',
'router',
'entity_types',
'entity_field_info',
'entity_bundles',
'local_task',
'library_info',
], Settings::get('cache_preload_tags', []));
$this->cacheTagsChecksum
->registerCacheTagsForPreload($default_preload_cache_tags);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() : array {
$events[KernelEvents::REQUEST][] = [
'onRequest',
500,
];
return $events;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| CacheTagPreloadSubscriber::getSubscribedEvents | public static | function | |
| CacheTagPreloadSubscriber::onRequest | public | function | Preloads frequently used cache tags. |
| CacheTagPreloadSubscriber::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.