unlcms / project-herbie

Drupal 10 implementation at the University of Nebraska–Lincoln
https://cms.unl.edu
GNU General Public License v2.0
6 stars 6 forks source link

Rename '_list' tags and use targeted tags to reduce unnecessary cache invalidations #158

Open macburgee1 opened 4 years ago

macburgee1 commented 4 years ago

From Views Custom Cache Tags:

Drupal 8 only has a single list cache tag for every entity type. Every view that lists nodes is tagged with node_list and will be invalidated when a node is added, changed or deleted.

Views usually have filters. They might list nodes of a specific type, or nodes that are tagged with a certain term and a combination of three other filters. By using more specific cache tags, it is possible to only update views that actually might list the changed node.

This issue proposes as follows:

  1. Rename '_list' tags see \Drupal\pantheon_advanced_page_cache\EventSubscriberCacheableResponseSubscriber::onRespond()
  2. Install Views Custom Cache Tags
  3. Update views to use custom cache tag(s)
  4. Write a custom module to invalidate new cache tags (e.g. hook_node_presave()) Consider writing a more generic module with a UI that can be contributed back to D.O.
macburgee1 commented 4 years ago

We may want to reconsider given Introduce ENTITY_TYPE_list:BUNDLE cache tag and add it to single bundle listing