Allow views base tables to define additional cache tags and max age

Created on 4 October 2016, about 8 years ago
Updated 20 February 2024, 9 months ago

Problem/Motivation

The file admin view is cached incorrectly because the file_usage table is just attached data to the file entities and the view is cached by tags. Tags are only available for file entities. We need to be able to add an additional tag to the view in \Drupal\file\FileViewsData::getViewsData() that we can clear when the file usage is updated. See #2810397: File usage view is cached and doesn't reflect real state for specific information of the file usage problem.

This is categorised as bug because without a fix along these lines it is impossible to ensure that caching works properly on views which use tag based caching and join to tables that are not entity based.

Proposed resolution

  • Allow views base tables to define view cache tags.
  • Allow views base tables to define view cache max age.
  • Use that information when caching a view

Remaining tasks

Update tests
Code review

User interface changes

None

API changes

Add support for declaring tags, max age and fix context in views data.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Views 

Last updated about 4 hours ago

Created by

🇬🇧United Kingdom alexpott 🇪🇺🌍

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

  • Security

    It is used for security vulnerabilities which do not need a security advisory. For example, security issues in projects which do not have security advisory coverage, or forward-porting a change already disclosed in a security advisory. See Drupal’s security advisory policy for details. Be careful publicly disclosing security vulnerabilities! Use the “Report a security vulnerability” link in the project page’s sidebar. See how to report a security issue for details.

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