/** * Flush caches according to the previously registered node changes. * * @return void */ public function shutdownObject() { if ($this->tagsToFlush !== array()) { if (count($this->domainsToFlush) > 0) { foreach ($this->domainsToFlush as $domain) { $this->varnishBanService->banByTags(array_keys($this->tagsToFlush), $domain); } } else { $this->varnishBanService->banByTags(array_keys($this->tagsToFlush)); } } }
/** * @param string $tags * @param Site $site * @return void */ public function purgeCacheByTagsAction($tags, Site $site = NULL) { $domain = $site !== NULL && $site->getFirstActiveDomain() !== NULL ? $site->getFirstActiveDomain()->getHostPattern() : NULL; $tags = explode(',', $tags); $service = new VarnishBanService(); $service->banByTags($tags, $domain); $this->flashMessageContainer->addMessage(new Message(sprintf('Varnish cache cleared for tags "%s" for %s', implode('", "', $tags), $site ? 'site ' . $site->getName() : 'installation'))); $this->redirect('index'); }