Project

General

Profile

Actions

Bug #93597

closed

Adding a TS template with the runThroughTemplatesPostProcessing hook leads to caching issues

Added by Jigal van Hemert over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2021-02-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The runThroughTemplatesPostProcessing hook in TemplateService is used to add a 'virutal' TS template (based on page properties).

In runThroughTemplates() each sys_template record also adds an item to the rowSum array (happens inside processTemplate() ).
After caches are cleared a hash from rowSum is used as key for caching all conditions. A hash of all matched conditions is used as key for caching all constants and setup.

If two pages only differ in the TS that the hook subscriber adds they will both get the same constants and setup from the cache (rowSum is equal and the same result from the conditions leads to the same key for the constants/setup cache).

If the hook subscriber could add items to rowSum the cache key would be different for both pages.

Example

Situation in site:

+-- start   <-- virtual TS added: "property=1" 
  +-- page1
  +-- page2  <-- virtual TS added: "property=2" 
  |  +-- page2.1
  |  +-- page2.2
  +-- page3

If you clear caches, visit page1 first the TS constants and setup are stored in cache. If you visit page2 (or a subpage) after that the rowSum matches, the conditions are the same and thus the constants and setup from page1 are loaded from cache and used for page2 (and subpages).
If you clear caches, visit page2 first that configuration will be used

Actions

Also available in: Atom PDF