Problem/Motivation

The Time cache plugin offers 0 => 'Never cache' for results_lifespan/output_lifespan, but 0 does not disable caching. getLifespan() returns 0, so Time::cacheSetMaxAge() returns Cache::PERMANENT and the item is stored permanently, dropped only by cache tag invalidation. The lifespan is a max age; 0 means no limit, i.e. the strongest caching, the opposite of what "Never cache" implies.

Steps to reproduce

See tests

Proposed resolution

Relabel 0 from "Never cache" to something accurate (e.g. "Cache until invalidated" / no maximum age), and document that the lifespan is a max age with 0 meaning no limit.

Remaining tasks

Agree wording; patch the option label and docs; add the kernel test.

User interface changes

The "Never cache" option label in the Time cache settings.

API changes

None.

Data model changes

None.

Issue fork drupal-3609866

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

herved created an issue. See original summary.

herved’s picture

For now I reported only and created a branch and MR showcasing the bug with a test.
The proposed resolution needs to be decided.

This also seems to relate to #3233105: Time-based custom caching is broken since configuration expects an integer.