Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FlushAllCacheObserver.php
Go to the documentation of this file.
1 <?php
7 
9 
11 {
17  protected $config;
18 
22  protected $purgeCache;
23 
28  public function __construct(
29  \Magento\PageCache\Model\Config $config,
30  \Magento\CacheInvalidate\Model\PurgeCache $purgeCache
31  ) {
32  $this->config = $config;
33  $this->purgeCache = $purgeCache;
34  }
35 
43  public function execute(\Magento\Framework\Event\Observer $observer)
44  {
45  if ($this->config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->config->isEnabled()) {
46  $this->purgeCache->sendPurgeRequest('.*');
47  }
48  }
49 }
execute(\Magento\Framework\Event\Observer $observer)
__construct(\Magento\PageCache\Model\Config $config, \Magento\CacheInvalidate\Model\PurgeCache $purgeCache)