Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract::_getUrlTtls PHP Method

_getUrlTtls() protected method

Format the by-url TTL value list
protected _getUrlTtls ( ) : string
return string
    protected function _getUrlTtls()
    {
        $str = array();
        $configTtls = Mage::helper('turpentine/data')->cleanExplode(PHP_EOL, Mage::getStoreConfig('turpentine_vcl/ttls/url_ttls'));
        $ttls = array();
        foreach ($configTtls as $line) {
            $ttls[] = explode(',', trim($line));
        }
        foreach ($ttls as $ttl) {
            $str[] = sprintf('if (bereq.url ~ "%s%s") { set beresp.ttl = %ds; }', $this->getBaseUrlPathRegex(), $ttl[0], $ttl[1]);
        }
        $str = implode(' else ', $str);
        if ($str) {
            $str .= sprintf(' else { set beresp.ttl = %ds; }', $this->_getDefaultTtl());
        } else {
            $str = sprintf('set beresp.ttl = %ds;', $this->_getDefaultTtl());
        }
        return $str;
    }