/**
  * 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));
         }
     }
 }
 /**
  * Clear all cache in Varnish for a optionally given domain & content type
  *
  * The domain is required since the expected VCL only bans for a given domain.
  *
  * @param string $domain The domain to flush, e.g. "example.com"
  * @param string $contentType The mime type to flush, e.g. "image/png"
  * @return void
  */
 public function clearCommand($domain = NULL, $contentType = NULL)
 {
     $this->varnishBanService->banAll($domain, $contentType);
 }
 /**
  * @param Site $site
  * @param string $contentType
  * @return void
  */
 public function purgeAllVarnishCacheAction(Site $site = NULL, $contentType = NULL)
 {
     $domain = $site !== NULL ? $site->getFirstActiveDomain()->getHostPattern() : NULL;
     $service = new VarnishBanService();
     $service->banAll($domain, $contentType);
     $this->flashMessageContainer->addMessage(new Message(sprintf('All varnish cache cleared for %s%s', $site ? 'site ' . $site->getName() : 'installation', $contentType ? ' with content type "' . $contentType . '"' : '')));
     $this->redirect('index');
 }