Skip to content

Commit f32229d

Browse files
authored
Merge pull request #27 from Flowpack/bugfix/cache-flushing
BUGFIX: Adapt cache flushing to Neos 9 cache flushing
2 parents d421298 + 6265312 commit f32229d

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

Diff for: Classes/Aspects/ContentCacheAspect.php

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Flowpack\FullPageCache\Aspects;
34

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

3839
/**
39-
* @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->shutdownObject())")
40+
* This aspect is for Neos 8.x compatibility and can be removed, when Neos 8.x isn't supported anymore.
41+
* See: ContentCacheAspect::interceptNodeCacheFlush() for Neos 9.x cache flushing
42+
*
43+
* @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->commit())")
4044
* @param JoinPointInterface $joinPoint
4145
*
4246
* @throws \Neos\Utility\Exception\PropertyNotAccessibleException
4347
*/
44-
public function interceptNodeCacheFlush(JoinPointInterface $joinPoint)
48+
public function interceptLegacyNodeCacheFlush(JoinPointInterface $joinPoint)
4549
{
4650
$object = $joinPoint->getProxy();
4751

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

57+
/**
58+
* @Flow\Before("method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->flushTagsImmediately())")
59+
* @param JoinPointInterface $joinPoint
60+
*
61+
* @throws \Neos\Utility\Exception\PropertyNotAccessibleException
62+
*/
63+
public function interceptNodeCacheFlush(JoinPointInterface $joinPoint)
64+
{
65+
$tags = $joinPoint->getMethodArgument('tagsToFlush');
66+
$tags = array_map([$this, 'sanitizeTag'], array_keys($tags));
67+
$this->cacheFrontend->flushByTags($tags);
68+
}
69+
5370
/**
5471
* @return bool
5572
*/

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It works by checking if a page is fully cachable and in that case caching the w
88
Settings
99
--------
1010

11-
Two settings are available to you to influence the behavior.
11+
Following settings are available to influence the behavior:
1212

1313
```yaml
1414
Flowpack:

0 commit comments

Comments
 (0)