Issue Bug Closed

#107097Wrong cache times for page-cache

Tim Lochmüller 07/14/25, 21:21 updated 11/07/26, 22:10

Description

Hey everyone,

in the context of EXT:staticfilecache we found out, that the cache time calculation of the core has some “mistakes” since TYPO3 v13. Perhaps somebody can check my thoughts and send me some feedback. (base issue: https://github.com/lochmueller/staticfilecache/pull/446 )

Related question: Do your TYPO3 installation has longer cache times than 24h?

*Not possible to reduce the calculated cache time.*
Possible problem that I identify in some tests is this line: https://github.com/TYPO3/typo3/blob/main/typo3/sysext/frontend/Classes/Cache/CacheLifetimeCalculator.php#L61 There is an internal cache for the calculation of calculateLifetimeForRow. The problem is, that the calculateLifetimeForRow method is called multiple times in the core. Sometimes with a changed $defaultCacheTimoutInSeconds but the $defaultCacheTimoutInSeconds is not part of the runtime cache identifier. So the first call is cached and if the method is called with a lower lifetime, we get the higher cached value.

*Not possible to increase the calculated cache time higher than 24h.*
The second problem is the default cache time of 24h https://github.com/TYPO3/typo3/blob/main/typo3/sysext/frontend/Classes/Cache/CacheLifetimeCalculator.php#L46 and the fallback to this value in the “calculateLifetimeForRow” function. The function is used in several ContentObjectRenderer calls without $defaultCacheTimoutInSeconds (here https://github.com/TYPO3/typo3/blob/main/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L481 and here https://github.com/TYPO3/typo3/blob/main/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L4777 ). As the result all the cache tags are added with a 24h cache time and the page cache could not be increased via page properties anymore.

Are these core problems or missing/wrong concepts in my brain ;)?

Regards,
Tim

Reviews 4

History 919

  1. Alexander Böhm commented <span data-processor="relativetime" data-value="2025-10-02T09:07:44+00:00" > 10/02/25, 09:07 </span>

    Hi,

    we can also see that there seems to be an issue with the CacheLifetimeCalculator in TYPO3 13.

    Setting the pages field ‘cache_timeout’ no longer has any effect.
    Inside the function ‘calculateLifetimeForRow’, I can see that the value from ‘cache_timeout’ gets overridden by the internal cache value.

    Our expectation:
    A defined ‘cache_timeout’ for a page should be applied to the cache entry.

    Regards,
    Alex

  2. network.publishing GmbH commented <span data-processor="relativetime" data-value="2025-11-04T11:52:00+00:00" > 11/04/25, 11:52 </span>

    We can confirm this misbehaviour. Cache lifetime default set via config.cache_period or individual page cache_timeout overrides have no effect if the feature toggle frontend.cache.autoTagging is enabled (enabled by default since 13.3 in new projects) – cache lifetime is then always set to 86400s.
    Turning off frontend.cache.autoTagging we see the intended cache TTLs.

  3. Sascha Nowak commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-12-08T17:55:08+00:00" > 12/08/25, 17:55 </span>

    Applied in changeset commit:ad3d93a0491741c65000cdb67d6a55daf6d6ba61.

  4. Alexander Grein commented <span data-processor="relativetime" data-value="2025-12-26T20:27:18+00:00" > 12/26/25, 20:27 </span>

    Still have this issue under TYPO3 13.4.22 with activated feature frontend.cache.autoTagging if I have a cached (extbase) plugin on a page

  5. Gerrit Code Review pushed patch set 1 for main to change 92850 status Resolved Under Review <span data-processor="relativetime" data-value="2026-02-14T14:45:04+00:00" > 02/14/26, 14:45 </span>

  6. Benni Mack commented and changed status Under Review Closed <span data-processor="relativetime" data-value="2026-11-07T22:10:25+00:00" > 11/07/26, 22:10 </span>

    closing this one, as a change has been applied in the meantime.