Skip to content
Snippets Groups Projects
Commit 25a8b704 authored by Benjamin Franzke's avatar Benjamin Franzke Committed by Susanne Moog
Browse files

[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: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: default avatarSusanne Moog <look@susi.dev>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarSusanne Moog <look@susi.dev>
parent b8cc136f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment