Skip to content

Commit

Permalink
Merge branch '4.0' of github.com:Flowpack/varnish
Browse files Browse the repository at this point in the history
  • Loading branch information
paxuclus committed Aug 17, 2021
2 parents 930aab8 + 6e8bd8f commit 06d5065
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Classes/Aspects/ContentCacheAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace Flowpack\Varnish\Aspects;

use Flowpack\Varnish\Service\CacheTagService;
use Flowpack\Varnish\Service\VarnishBanService;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Aop\JoinPointInterface;
use Neos\Flow\Configuration\Exception\InvalidConfigurationException;
Expand Down Expand Up @@ -30,6 +32,18 @@ class ContentCacheAspect
*/
protected $logger;

/**
* @Flow\Inject
* @var VarnishBanService
*/
protected $varnishBanService;

/**
* @Flow\Inject
* @var CacheTagService
*/
protected $cacheTagService;

/**
* @var bool
*/
Expand Down Expand Up @@ -106,6 +120,21 @@ public function registerDisableContentCache(JoinPointInterface $joinPoint): void
}
}

/**
* @Flow\Before("setting(Flowpack.Varnish.enabled) && method(Neos\Neos\Fusion\Cache\ContentCacheFlusher->shutdownObject())")
* @param JoinPointInterface $joinPoint
*
* @throws PropertyNotAccessibleException
*/
public function interceptContentCacheFlush(JoinPointInterface $joinPoint)
{
$object = $joinPoint->getProxy();

$tags = array_keys(ObjectAccess::getProperty($object, 'tagsToFlush', true));

$this->varnishBanService->banByTags($tags);
}

/**
* @return bool true if an uncached segment was evaluated
*/
Expand Down
2 changes: 2 additions & 0 deletions Classes/Service/ContentCacheFlusherService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

/**
* @Flow\Scope("singleton")
*
* @deprecated will be removed with 6.0
*/
class ContentCacheFlusherService
{
Expand Down

0 comments on commit 06d5065

Please sign in to comment.