Skip to content

Commit

Permalink
Merge pull request #27 from Flowpack/bugfix/cache-flushing
Browse files Browse the repository at this point in the history
BUGFIX: Adapt cache flushing to Neos 9 cache flushing
  • Loading branch information
mficzel authored Jan 7, 2025
2 parents d421298 + 6265312 commit f32229d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
21 changes: 19 additions & 2 deletions Classes/Aspects/ContentCacheAspect.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Flowpack\FullPageCache\Aspects;

use Neos\Cache\Frontend\StringFrontend;
Expand Down Expand Up @@ -36,12 +37,15 @@ public function grabUncachedSegment(JoinPointInterface $joinPoint)
}

/**
* @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->shutdownObject())")
* 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 interceptNodeCacheFlush(JoinPointInterface $joinPoint)
public function interceptLegacyNodeCacheFlush(JoinPointInterface $joinPoint)
{
$object = $joinPoint->getProxy();

Expand All @@ -50,6 +54,19 @@ public function interceptNodeCacheFlush(JoinPointInterface $joinPoint)
$this->cacheFrontend->flushByTags($tags);
}

/**
* @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->flushTagsImmediately())")
* @param JoinPointInterface $joinPoint
*
* @throws \Neos\Utility\Exception\PropertyNotAccessibleException
*/
public function interceptNodeCacheFlush(JoinPointInterface $joinPoint)
{
$tags = $joinPoint->getMethodArgument('tagsToFlush');
$tags = array_map([$this, 'sanitizeTag'], array_keys($tags));
$this->cacheFrontend->flushByTags($tags);
}

/**
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f32229d

Please sign in to comment.