Lifetime of cache is not properly computed for "Insert Records" CE
- A content element (text/image/...) is prepared and corresponding start/end times are specified
- This content element is to be used at multiple places on the website and is thus referenced (paste as reference when using EXT:gridelements or simply using "Insert Records" TYPO3-native CE
- When the content element on the "master" page finally shows up (or disappears), every page having a reference to that content element should be automatically updated, that is the cache should be invalidated.
- Only the cache of the "master" page is automatically flushed
- Other page's caches are not invalidated and a manual flush is required (or a force-reload while being logged-in into the Backend).
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getFirstTimeValueForRecord() is supposed to compute the cache lifetime of CEs on a given page. But it only takes into account the start/end fields of the corresponding records.
For "Insert Records" (=
shortcut) content element, only the start/end times of the shortcut are taken into account but not the ones of the referenced records.
Expected behaviour: both start/end times of the shortcut CE and all the associated records should be taken into account in that particular context.
In addition, and this could be a real improvement for extension authors, it would be useful to allow extensions to "hook" (PSR-14 if speaking from TYPO3 v10 or master branch, signals/whatever before) so that plugins may benefit from the same possibility than this very shortcut CE to post-process the lifetime in the context, e.g., of a plugin doing some temporary caching of external data and where one way (only "good" one?) to properly handle such case is to add tags to the corresponding page cache and to
flushByTags() asynchronously when fetching remote data (or force the whole page to be cached for a shorter period of time).