![]() Internal Page Cache caches pages for anonymous users. Still, this topic remains unrevealed to many developers as they consider caching to be a critical aspect of a website. What about cache and optimization in Drupal 8 By default, Drupal 8 enables two modules: Internal Page Cache and Internal Dynamic Page Cache. MYMODULE/EventSubscriber/MyEventSubscriber. We are well aware of the fact that Drupal Cache API is a remarkable feature introduced in Drupal 8. They're sets because a single cache item can depend on (vary by) many cache contexts. Cache contexts are passed around in sets (order doesn't matter) of strings, so they are typehinted to string. If your preprocess doesn't affect the result of the page, and needs to execute even when the page is served from the page cache, you should move your logic to a Kernel Event subscriber, which replaces hook_boot() and hook_exit() from Drupal 7.ĭrupalizeMe has an article on Event Subscribers, but the basic components are creating a class that implements EventSubscriberInterface, and then registering it as a service. A cache context is a string that refers to one of the available cache context services (see below). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |