public function checkCacheConditions($type = 'template', $checkoverride = false)
    {
        Deprecated::method(3.3);

        // Do not cache in "safe" mode: we don't want to accidentally bleed
        // sensitive data from a previous unsafe run.
        if ($this->safe) {
            return false;
        }

        // Only cache for 'get' requests.
        if ($this->app['request']->getMethod() !== 'GET') {
            return false;
        }

        // Don't use the cache, if not enabled in the config.
        if (!$this->app['config']->get('general/caching/' . $type)) {
            return false;
        }

        // Don't use the cache, if we're currently logged in. (unless explicitly enabled in config.yml
        if (!$this->app['config']->get('general/caching/authenticated') &&
            $this->app['users']->getCurrentUsername() !== null) {
            return false;
        }

        // if we've added 'force_refresh=1', we don't use the cache. Note, in most cases,
        // we don't _fetch_ from the cache, but we do allow _saving_ to the cache.
        if ($checkoverride && $this->app['request']->get('force_refresh') == 1) {
            return false;
        }

        // All's well!
        return true;
    }
public function checkCacheConditions($type = 'template', $checkoverride = false)
    {
        Deprecated::method(3.3);

        // Do not cache in "safe" mode: we don't want to accidentally bleed
        // sensitive data from a previous unsafe run.
        if ($this->safe) {
            return false;
        }

        // Only cache for 'get' requests.
        if ($this->app['request']->getMethod() !== 'GET') {
            return false;
        }

        // Don't use the cache, if not enabled in the config.
        if (!$this->app['config']->get('general/caching/' . $type)) {
            return false;
        }

        // Don't use the cache, if we're currently logged in. (unless explicitly enabled in config.yml
        if (!$this->app['config']->get('general/caching/authenticated') &&
            $this->app['users']->getCurrentUsername() !== null) {
            return false;
        }

        // if we've added 'force_refresh=1', we don't use the cache. Note, in most cases,
        // we don't _fetch_ from the cache, but we do allow _saving_ to the cache.
        if ($checkoverride && $this->app['request']->get('force_refresh') == 1) {
            return false;
        }

        // All's well!
        return true;
    }
public function checkCacheConditions ( $ type = 'template' , $ checkoverride = false ) { Deprecated :: method ( 3.3 ) ; // Do not cache in "safe" mode: we don't want to accidentally bleed // sensitive data from a previous unsafe run. if ( $ this -> safe ) { return false ; } // Only cache for 'get' requests. if ( $ this -> app [ 'request' ] -> getMethod ( ) !== 'GET' ) { return false ; } // Don't use the cache, if not enabled in the config. if ( ! $ this -> app [ 'config' ] -> get ( 'general/caching/' . $ type ) ) { return false ; } // Don't use the cache, if we're currently logged in. (unless explicitly enabled in config.yml if ( ! $ this -> app [ 'config' ] -> get ( 'general/caching/authenticated' ) && $ this -> app [ 'users' ] -> getCurrentUsername ( ) !== null ) { return false ; } // if we've added 'force_refresh=1', we don't use the cache. Note, in most cases, // we don't _fetch_ from the cache, but we do allow _saving_ to the cache. if ( $ checkoverride && $ this -> app [ 'request' ] -> get ( 'force_refresh' ) == 1 ) { return false ; } // All's well! return true ; }
Check if the current conditions are suitable for caching.

@deprecated Deprecated since 3.1, to be removed in 4.0. @see \Silex\HttpCache

@param string $type
@param bool   $checkoverride

@return bool
Check if the current conditions are suitable for caching .