From cd30c0e2c482a7e619de8e1489b0719f9583d36e Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Thu, 21 May 2026 09:02:13 +0200 Subject: [PATCH] [FEATURE] provide an event before data are added to cache this event allows you to modify the cacheTags. can be usefull if page-cache has a lot of tags (e.g. EXT:menus is installed) and you want to reduce the cacheTags to the page cache tag 'pageId_' --- .../Event/BeforeDataAreAddedToCacheEvent.php | 23 +++++++++++++++++++ Classes/PageRendererHook.php | 8 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 Classes/Event/BeforeDataAreAddedToCacheEvent.php diff --git a/Classes/Event/BeforeDataAreAddedToCacheEvent.php b/Classes/Event/BeforeDataAreAddedToCacheEvent.php new file mode 100644 index 0000000..af57bbb --- /dev/null +++ b/Classes/Event/BeforeDataAreAddedToCacheEvent.php @@ -0,0 +1,23 @@ +getPageCacheIdentifier(); $cacheTags = array_map(fn(CacheTag $cacheTag) => $cacheTag->name, $cacheDataCollector->getCacheTags()); $cacheTimeout = $cacheDataCollector->resolveLifetime(); + $beforeDataAreAddedToCacheEvent = new BeforeDataAreAddedToCacheEvent($request, $cacheTags); + $this->eventDispatcher->dispatch($beforeDataAreAddedToCacheEvent); + $cacheTags = $beforeDataAreAddedToCacheEvent->cacheTags; $this->cache->set($identifier, $data, $cacheTags, $cacheTimeout); }