These are converted to a final value depending on the request. ![]() contexts specifies one or more cache context IDs. We are well aware of the fact that Drupal Cache API is a remarkable feature introduced in Drupal 8. Default cache tag for a node would be like node:. Drupal 8 Cache Context: An efficient way for context based caching.Cache Tags are used while caching data for entities, configuration etc. ![]() MYMODULE/EventSubscriber/MyEventSubscriber. Drupal 8 provides several kinds out of the box: max-age stores cache data by defining its time in integer format and seconds tags is an array of one or more cache tags identifying the data this element depends on. Drupal 8 has provided 3 types of cache implementations: Cache Contexts Cache Tags Max age Cache Contexts are used for caching the content based on events like language based, url based, role based etc. ![]() 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. Drupal core also provides a mechanism here that allows us to say this piece of cache data relies on this other piece of cache data.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |