#106707"Clear cache for this page" does not clear cache for included TypoScript using INCLUDE_TYPOSCRIPT syntax
Description
Clicking the “Clear cache for this page” button for does not clear cache for included TypoScript using INCLUDE_TYPOSCRIPT syntax, neither for Constants nor Setup. This was originally reported here: https://talk.typo3.org/t/after-upgrade-from-11-to-12-clearing-a-page-cache-does-not-reload-included-constants-files/6273
This seems to be a regression. My tests have been in TYPO3 v12.4.29 and v13.4.8, where the bug appears. The reporter on talk.typo3.org has tested in TYPO3 v11, where the cache apparently clears properly. I have not tested in TYPO3 v11.
Steps to reproduce:
1. Create a file in fileadmin/xyz/constants.txt containing this line:
worksText = does work
2. Create a new site with a TypoScript template. (Tested with clear Constants and Setup, as well as Rootlevel checked.) Add TypoScript as follows:
Constants:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/xyz/constants.txt">
Setup:
page = PAGE
page.10 = TEXT
page.10.value = {$worksText}
3. Save the TypoScript template and preview the page. (You may choose to clear the frontend cache using the drop-down menu, though this should already happen when you save the TypoScript file.)
4. Preview the page. It should show the text “does work”.
5. Change the text in fileadmin/xyz/constants.txt to:
worksText = does not work
6. Clear the cache using the “Clear cache for this page” (lightning icon) on the page where the TypoScript template resides.
7. Preview the page. It should still show the text “does work”. If the cache had been cleared, the page would have displayed “does not work”.
I have done further tests, and the issue seems to be strictly related to the use of the INCLUDE_TYPOSCRIPT syntax.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 7
-
Stefanos Karasavvidis commented <span data-processor="relativetime" data-value="2025-05-15T14:02:48+00:00" > 05/15/25, 14:02 </span>
-
Georg Ringer commented <span data-processor="relativetime" data-value="2025-05-17T07:29:59+00:00" > 05/17/25, 07:29 </span>
IMO not a bug, the cache of the page is independent from the cache of TypoScript. handing it over to christian to decide
-
Georg Ringer changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2025-05-17T07:31:38+00:00" > 05/17/25, 07:31 </span> -
Stefanos Karasavvidis commented <span data-processor="relativetime" data-value="2025-05-19T17:11:04+00:00" > 05/19/25, 17:11 </span>
well, at least we should agree that the behavior between 11 and 12 changed, and that this is not documented.
-
Christian Kuhn commented and changed status
Needs FeedbackResolved <span data-processor="relativetime" data-value="2025-05-20T13:42:41+00:00" > 05/20/25, 13:42 </span>The changed cache behavior is documented with https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Breaking-97816-NewTypoScriptParserInFrontend.html
“Clear frontend caches” works because this functionality triggers flush of the ‘pages’ cache group, and the TypoScript cache is part of that group.
Some background on why this can’t be resolved: One of the main achievements with the v12 TS parser is its ability to share parsed typoscript segments across multiple pages, leading to significant performance improvements especially with larger instances.
Prior to v12, TS was always calculated for one page only, leading to tons of duplicate data and forcing recalculation of the entire TS per page. Since v12, TS caches are shared, a call to one page basically warms up TS caches for other pages as well when they share TS snippets. (sidenote: this also made USER_INT and COA_INT much cheaper). To avoid recalculating the “full TS tree” each time, and to reduce disk load, included files do not add a hash of their content to the cache identifiers. Thus a) TS caches do not know on which pages they are actually used, and b) do not recognize when their file contents change and can’t invalidate automatically when that happens.
The only workaround in your case is maybe turning the file content into sys_template DB content: TS sys_template rows have to be fetched per page call anyways (for various reasons), and TS DB rows hash their field contents into the cache identifiers, leading to automatic recalculation on change.
-
Stefanos Karasavvidis commented <span data-processor="relativetime" data-value="2025-05-20T17:09:50+00:00" > 05/20/25, 17:09 </span>
Thanks for the detailed clarifications on this issue. I understand the reasoning behind all these changes. I will have to live with it….
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-08-12T14:35:49+00:00" > 08/12/25, 14:35 </span>
I also tried the following, which used to work with TYPO3 11, but it no longer does. I’m aware that the class is marked as internal.
\TYPO3\CMS\Extbase\Service\CacheService $cacheService;
$cacheService->clearPageCache($pageId)->clearPageCache($somePageId);