Skip to content

Instantly share code, notes, and snippets.

@evgv
Last active January 5, 2017 13:28
Show Gist options
  • Save evgv/54ca39136229c26c9762d86c105c3b20 to your computer and use it in GitHub Desktop.
Save evgv/54ca39136229c26c9762d86c105c3b20 to your computer and use it in GitHub Desktop.
Magento. Flush varnish cache

Flush varnish cache, work with extension Phoenix_VarnishCache

Use method clean() from class Phoenix_VarnishCache_Model_Control for flush varnich cache, more info you can see in this class.

  
    /**
     * Flush all varnish cache
     * 
     * @var cache Phoenix_VarnishCache_Model_Control
     */
    try {
        $cache = Mage::getSingleton('varnishcache/control');
        if ($cache) {
            $cache->clean(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
        }
        
    } catch (Exception $exc) {
        Mage::log($exc->getTraceAsString(), null, __METHOD__.'__ERR.log', true);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment