concrete/src/Cache/Page/PageCache.php
public function shouldAddToCache(PageView $v)
    {
        $c = $v->getPageObject();
        if (!is_object($c)) {
            return false;
        }

        $cp = new Checker($c);
        if (!$cp->canViewPage()) {
            return false;
        }

        if (is_object($v->controller)) {
            $allowedControllerActions = ['view'];
            if (!in_array($v->controller->getAction(), $allowedControllerActions)) {
                return false;
            }
            if ($c->isGeneratedCollection() && !$v->controller->supportsPageCache()) {
                return false;
            }
        }

        if (!$c->getCollectionFullPageCaching()) {
            return false;
        }

        $app = Application::getFacadeApplication();
        $request = $app->make(Request::class);
        if ($request->getMethod() === $request::METHOD_POST) {
            return false;
        }

        $u = $app->make(User::class);
        if ($u->isRegistered()) {
            return false;
        }

        $config = $app->make('config');
        if ($c->getCollectionFullPageCaching() == 1 || $config->get('concrete.cache.pages') === 'all') {
            // this cache page at the page level
            // this overrides any global settings
            return true;
        }

        if ($config->get('concrete.cache.pages') !== 'blocks') {
            // we are NOT specifically caching this page, and we don't
            return false;
        }

        $blocks = $c->getBlocks();
        $blocks = array_merge($c->getGlobalBlocks(), $blocks);

        foreach ($blocks as $b) {
            if (!$b->cacheBlockOutput()) {
                return false;
            }
        }

        return true;
    }
public function shouldAddToCache(PageView $v)
    {
        $c = $v->getPageObject();
        if (!is_object($c)) {
            return false;
        }

        $cp = new Checker($c);
        if (!$cp->canViewPage()) {
            return false;
        }

        if (is_object($v->controller)) {
            $allowedControllerActions = ['view'];
            if (!in_array($v->controller->getAction(), $allowedControllerActions)) {
                return false;
            }
            if ($c->isGeneratedCollection() && !$v->controller->supportsPageCache()) {
                return false;
            }
        }

        if (!$c->getCollectionFullPageCaching()) {
            return false;
        }

        $app = Application::getFacadeApplication();
        $request = $app->make(Request::class);
        if ($request->getMethod() === $request::METHOD_POST) {
            return false;
        }

        $u = $app->make(User::class);
        if ($u->isRegistered()) {
            return false;
        }

        $config = $app->make('config');
        if ($c->getCollectionFullPageCaching() == 1 || $config->get('concrete.cache.pages') === 'all') {
            // this cache page at the page level
            // this overrides any global settings
            return true;
        }

        if ($config->get('concrete.cache.pages') !== 'blocks') {
            // we are NOT specifically caching this page, and we don't
            return false;
        }

        $blocks = $c->getBlocks();
        $blocks = array_merge($c->getGlobalBlocks(), $blocks);

        foreach ($blocks as $b) {
            if (!$b->cacheBlockOutput()) {
                return false;
            }
        }

        return true;
    }
public function shouldAddToCache ( PageView $ v ) { $ c = $ v -> getPageObject ( ) ; if ( ! is_object ( $ c ) ) { return false ; } $ cp = new Checker ( $ c ) ; if ( ! $ cp -> canViewPage ( ) ) { return false ; } if ( is_object ( $ v -> controller ) ) { $ allowedControllerActions = [ 'view' ] ; if ( ! in_array ( $ v -> controller -> getAction ( ) , $ allowedControllerActions ) ) { return false ; } if ( $ c -> isGeneratedCollection ( ) && ! $ v -> controller -> supportsPageCache ( ) ) { return false ; } } if ( ! $ c -> getCollectionFullPageCaching ( ) ) { return false ; } $ app = Application :: getFacadeApplication ( ) ; $ request = $ app -> make ( Request :: class ) ; if ( $ request -> getMethod ( ) === $ request :: METHOD_POST ) { return false ; } $ u = $ app -> make ( User :: class ) ; if ( $ u -> isRegistered ( ) ) { return false ; } $ config = $ app -> make ( 'config' ) ; if ( $ c -> getCollectionFullPageCaching ( ) == 1 || $ config -> get ( 'concrete.cache.pages' ) === 'all' ) { // this cache page at the page level // this overrides any global settings return true ; } if ( $ config -> get ( 'concrete.cache.pages' ) !== 'blocks' ) { // we are NOT specifically caching this page, and we don't return false ; } $ blocks = $ c -> getBlocks ( ) ; $ blocks = array_merge ( $ c -> getGlobalBlocks ( ) , $ blocks ) ; foreach ( $ blocks as $ b ) { if ( ! $ b -> cacheBlockOutput ( ) ) { return false ; } } return true ; }
Check if a page contained in a PageView should be stored in the cache.

@param \Concrete\Core\Page\View\PageView $v

@return bool
Check if a page contained in a PageView should be stored in the cache .