From 9ef5dcd9fbd5abf7040af439f1131e9bddb5cfb1 Mon Sep 17 00:00:00 2001 From: Denny Lubitz Date: Mon, 30 Dec 2024 13:42:46 +0100 Subject: [PATCH 1/2] BUGFIX: Adapt cache flushing to Neos 9 cache flushing --- Classes/Aspects/ContentCacheAspect.php | 6 ++---- README.md | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Classes/Aspects/ContentCacheAspect.php b/Classes/Aspects/ContentCacheAspect.php index 2049dd7..1c2b2c4 100644 --- a/Classes/Aspects/ContentCacheAspect.php +++ b/Classes/Aspects/ContentCacheAspect.php @@ -36,16 +36,14 @@ public function grabUncachedSegment(JoinPointInterface $joinPoint) } /** - * @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->shutdownObject())") + * @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->flushTagsImmediately())") * @param JoinPointInterface $joinPoint * * @throws \Neos\Utility\Exception\PropertyNotAccessibleException */ public function interceptNodeCacheFlush(JoinPointInterface $joinPoint) { - $object = $joinPoint->getProxy(); - - $tags = ObjectAccess::getProperty($object, 'tagsToFlush', true); + $tags = $joinPoint->getMethodArgument('tagsToFlush'); $tags = array_map([$this, 'sanitizeTag'], array_keys($tags)); $this->cacheFrontend->flushByTags($tags); } diff --git a/README.md b/README.md index 74ac9ee..3cd6405 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ It works by checking if a page is fully cachable and in that case caching the w Settings -------- -Two settings are available to you to influence the behavior. +Following settings are available to influence the behavior: ```yaml Flowpack: From 62653121e2f7ebbb8e085f6c4e5eb3c017dc4e98 Mon Sep 17 00:00:00 2001 From: Denny Lubitz Date: Fri, 3 Jan 2025 14:25:25 +0100 Subject: [PATCH 2/2] BUGFIX: Keep Neos 8.x compatibility --- Classes/Aspects/ContentCacheAspect.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Classes/Aspects/ContentCacheAspect.php b/Classes/Aspects/ContentCacheAspect.php index 1c2b2c4..9301326 100644 --- a/Classes/Aspects/ContentCacheAspect.php +++ b/Classes/Aspects/ContentCacheAspect.php @@ -1,4 +1,5 @@ hadUncachedSegments = true; } + /** + * This aspect is for Neos 8.x compatibility and can be removed, when Neos 8.x isn't supported anymore. + * See: ContentCacheAspect::interceptNodeCacheFlush() for Neos 9.x cache flushing + * + * @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->commit())") + * @param JoinPointInterface $joinPoint + * + * @throws \Neos\Utility\Exception\PropertyNotAccessibleException + */ + public function interceptLegacyNodeCacheFlush(JoinPointInterface $joinPoint) + { + $object = $joinPoint->getProxy(); + + $tags = ObjectAccess::getProperty($object, 'tagsToFlush', true); + $tags = array_map([$this, 'sanitizeTag'], array_keys($tags)); + $this->cacheFrontend->flushByTags($tags); + } + /** * @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->flushTagsImmediately())") * @param JoinPointInterface $joinPoint