Skip to content

Conversation

@timkelty
Copy link
Contributor

Description

If something calls stopCollectingCacheInfo, there is no way to know if the elements had a duration, or if the default duration from config was used.

This moves the application of the default to \craft\services\TemplateCaches::endTemplateCache.

Use-case

Craft Cloud uses \craft\services\Elements::stopCollectingCacheInfo to collect tags and expiry for static cache. It has it's own default for static cache (1 year), but because a duration is always returned (even if it is just the default config fallback), there isn't a way to know if it actually came from an element.

Notes

To avoid this kind of thing, future versions should separate cache duration settings by use-case, e.g. templateCacheDuration, instead of sharing one config value.

@brandonkelly brandonkelly changed the base branch from 4.x to 6.x December 28, 2025 17:38
@brandonkelly
Copy link
Member

This is a breaking change, so retargetted to 6.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants