[TASK] Consolidate cache clearing in TypoScript edit backend controllers
The TypoScript editing module "Template" currently has different cache flush behaviours, depending on *how* the data is being modified: a) The DataHandler cache command 'all' is triggered when a TypoScript constant is changed via the ObjectBrowser or ConstantEditor controllers and when a new sys_template record is created. b) Tag-based cache clearing in group 'pages' is performed by the DataHandler when a TypoScript template is edited via "Edit the whole template record" button. Note: This is because the edit functionality is using the plain record_edit FromEngine controller which means EXT:tstemplate controllers only act as proxy here. Note that both cases are wrong for sys_template records: * Case a) flushes too many caches: The DataHandler cache command 'all' flushes TCA, ext_localconf and Dependency Injection caches – since #75581 even opcache caches. All these (performance relevant) caches are never influenced by TypoScript and must not be flushed in production systems (results in slow responses due to cache rebuilds). * Case b) flushes too few caches: A sys_template record influences (in 99.9% cases) the page tree. By flushing the record via DataHandler tag flushed there are two caches being flushed: * pageId_[pidOfSysTemplateRecord] * sys_template_[uidOfSysTemplateRecord] * sys_template Non of these tags are assigned to page caches that rely on this sys_template record. There are two options to consolidate cache clearing: * Use DataHandler tag-based flushing as in case b). The drawback: generates *a lot* of cache tags which are then flushed very rarely. * Flush the 'pages' cache group in both cases. This variant flushes a bit too much (of course, tags are more precise), as pages which did not rely on a currently modified sys_template record are flushed as well. This change implements the latter option as we think the drawbacks of flushing a bit too much is better than the drawback of generating a ton of cache tags. As all cases where the cache command 'all' was used, already modify sys_template though DataHandler processing, we can remove the previous cache commands and move the flush logic for all cases into a hook that is triggered by the DataHandler when records are being created/changed. Releases: master Resolves: #89280 Change-Id: I4b705398634048ccf9fb7fe53acf2eb15fa55562 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61834 Reviewed-by:Benni Mack <benni@typo3.org> Reviewed-by:
Daniel Goerz <daniel.goerz@posteo.de> Reviewed-by:
Susanne Moog <look@susi.dev> Tested-by:
TYPO3com <noreply@typo3.com> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Susanne Moog <look@susi.dev>
Showing
- typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php 0 additions, 2 deletions...oScriptTemplateConstantEditorModuleFunctionController.php
- typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php 0 additions, 1 deletion...Classes/Controller/TypoScriptTemplateModuleController.php
- typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateObjectBrowserModuleFunctionController.php 0 additions, 2 deletions...poScriptTemplateObjectBrowserModuleFunctionController.php
- typo3/sysext/tstemplate/Classes/Hooks/DataHandlerClearCachePostProcHook.php 42 additions, 0 deletions...plate/Classes/Hooks/DataHandlerClearCachePostProcHook.php
- typo3/sysext/tstemplate/Configuration/Services.yaml 3 additions, 0 deletionstypo3/sysext/tstemplate/Configuration/Services.yaml
- typo3/sysext/tstemplate/ext_localconf.php 4 additions, 0 deletionstypo3/sysext/tstemplate/ext_localconf.php
Please register or sign in to comment