Observer/InvalidateVarnishObserver.php
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
            $object = $observer->getEvent()->getObject();

            if ($object instanceof \Magento\Framework\DataObject\IdentityInterface && $this->canPurgeObject($object)) {
                $tags = [];
                foreach ($object->getIdentities() as $tag) {
                    $tag = $this->cacheTags->convertCacheTags($tag);
                    if (!in_array($tag, $this->alreadyPurged)) {
                        $tags[] = $tag;
                        $this->alreadyPurged[] = $tag;
                    }
                }

                if (!empty($tags)) {
                    $this->purgeCache->sendPurgeRequest(array_unique($tags));
                }
            }
        }
    }
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
            $object = $observer->getEvent()->getObject();

            if ($object instanceof \Magento\Framework\DataObject\IdentityInterface && $this->canPurgeObject($object)) {
                $tags = [];
                foreach ($object->getIdentities() as $tag) {
                    $tag = $this->cacheTags->convertCacheTags($tag);
                    if (!in_array($tag, $this->alreadyPurged)) {
                        $tags[] = $tag;
                        $this->alreadyPurged[] = $tag;
                    }
                }

                if (!empty($tags)) {
                    $this->purgeCache->sendPurgeRequest(array_unique($tags));
                }
            }
        }
    }
public function execute ( \ Magento \ Framework \ Event \ Observer $ observer ) { if ( $ this -> config -> getType ( ) == Config :: FASTLY && $ this -> config -> isEnabled ( ) ) { $ object = $ observer -> getEvent ( ) -> getObject ( ) ; if ( $ object instanceof \ Magento \ Framework \ DataObject \ IdentityInterface && $ this -> canPurgeObject ( $ object ) ) { $ tags = [ ] ; foreach ( $ object -> getIdentities ( ) as $ tag ) { $ tag = $ this -> cacheTags -> convertCacheTags ( $ tag ) ; if ( ! in_array ( $ tag , $ this -> alreadyPurged ) ) { $ tags [ ] = $ tag ; $ this -> alreadyPurged [ ] = $ tag ; } } if ( ! empty ( $ tags ) ) { $ this -> purgeCache -> sendPurgeRequest ( array_unique ( $ tags ) ) ; } } } }
If Fastly CDN is enabled it sends one purge request per tag

@param \Magento\Framework\Event\Observer $observer
@throws \Zend_Uri_Exception
If Fastly CDN is enabled it sends one purge request per tag