Problem/Motivation

Views provides a cache plugin type, which allows you to select the caching options for your view.

However, it's not clear how much this does.

For instance, the plugin's cacheSetMaxAge() has no effect on the cacheability of the rendered view.
But getCacheTags() does.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3631718

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joachim created an issue. See original summary.

leandro713’s picture

Assigned: Unassigned » leandro713

I’d like to work on clarifying the Views cache plugin behavior in CachePluginBase documentation.

joachim’s picture

Title: CachePluginBase should document the cache functionality of Views cache plugikns » CachePluginBase should document the cache functionality of Views cache plugins

leandro713’s picture

Assigned: leandro713 » Unassigned
Status: Active » Needs review

Clarified the Views cache documentation to distinguish result-cache expiration from the rendered view’s max-age. Also clarified cache-tag usage and the currently supported cache type. The relevant tests, PHP syntax check and PHPCS pass.

ishfaqafridi85’s picture

Status: Needs review » Needs work

One small clarification: Time::getDefaultCacheMaxAge() also uses cacheSetMaxAge('output'). Please make the new comment specific to cacheSetMaxAge('results').

disclosure: tested with the help of an LLM.

leandro713’s picture

Assigned: Unassigned » leandro713

I’ve identified the issue in the comment for cacheSetMaxAge(): it describes the behaviour too broadly, even though getDefaultCacheMaxAge() also calls cacheSetMaxAge('output'), which affects the rendered view’s max-age. I’ll update the documentation to make clear that the statement applies specifically to cacheSetMaxAge('results').

leandro713’s picture

Assigned: leandro713 » Unassigned
Status: Needs work » Needs review