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

Created on 4 October 2016, over 7 years ago
Updated 20 February 2024, 4 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.69.0 2024