Skip to content

Commit 06d5065

Browse files
committed
Merge branch '4.0' of github.com:Flowpack/varnish
2 parents 930aab8 + 6e8bd8f commit 06d5065

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Classes/Aspects/ContentCacheAspect.php

+29
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
namespace Flowpack\Varnish\Aspects;
55

6+
use Flowpack\Varnish\Service\CacheTagService;
7+
use Flowpack\Varnish\Service\VarnishBanService;
68
use Neos\Flow\Annotations as Flow;
79
use Neos\Flow\Aop\JoinPointInterface;
810
use Neos\Flow\Configuration\Exception\InvalidConfigurationException;
@@ -30,6 +32,18 @@ class ContentCacheAspect
3032
*/
3133
protected $logger;
3234

35+
/**
36+
* @Flow\Inject
37+
* @var VarnishBanService
38+
*/
39+
protected $varnishBanService;
40+
41+
/**
42+
* @Flow\Inject
43+
* @var CacheTagService
44+
*/
45+
protected $cacheTagService;
46+
3347
/**
3448
* @var bool
3549
*/
@@ -106,6 +120,21 @@ public function registerDisableContentCache(JoinPointInterface $joinPoint): void
106120
}
107121
}
108122

123+
/**
124+
* @Flow\Before("setting(Flowpack.Varnish.enabled) && method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->shutdownObject())")
125+
* @param JoinPointInterface $joinPoint
126+
*
127+
* @throws PropertyNotAccessibleException
128+
*/
129+
public function interceptContentCacheFlush(JoinPointInterface $joinPoint)
130+
{
131+
$object = $joinPoint->getProxy();
132+
133+
$tags = array_keys(ObjectAccess::getProperty($object, 'tagsToFlush', true));
134+
135+
$this->varnishBanService->banByTags($tags);
136+
}
137+
109138
/**
110139
* @return bool true if an uncached segment was evaluated
111140
*/

Classes/Service/ContentCacheFlusherService.php

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* @Flow\Scope("singleton")
21+
*
22+
* @deprecated will be removed with 6.0
2123
*/
2224
class ContentCacheFlusherService
2325
{

0 commit comments

Comments
 (0)