Use new cache tag ENTITY_TYPE_list:BUNDLE in Views to improve cache hit rate

Created on 17 May 2019, over 5 years ago
Updated 19 June 2023, over 1 year ago

I think there is a performance problem when views are displayed on every site page and when there is a lot of content (node, term, etc) modification.

The problem appears on the following circumstances :

  1. There is (for example) 3 nodes updated every minute
  2. There is a view which list nodes on the homepage
  3. There is a views which list nodes on a sidebar on every page
  4. The page_cache module is enabled

Views will add a "node_list" tag on every views (cf https://git.drupalcode.org/project/drupal/blob/8.7.x/core/modules/views/...).

Pages with view (so every page here) will have the "node_list" tag because tags are bubbled on the entire page.
So every minute all page cache will be invalidated 3 times (after each node update) and it will be like there is no cache at all.

This problem occurs even if the nodes updated are not displayed in these views because the tag "[entity_type]_list" is too generic.

The issue https://www.drupal.org/project/drupal/issues/2145751 β†’ introduce a new cache tag per bundle we can use in Views to avoid to invalidate the whole cache site on each node save.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 13 hours ago

Created by

πŸ‡«πŸ‡·France Nixou Toulon

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024