function PageCache::handle

Same name in other branches
  1. 9 core/modules/page_cache/src/StackMiddleware/PageCache.php \Drupal\page_cache\StackMiddleware\PageCache::handle()
  2. 8.9.x core/modules/page_cache/src/StackMiddleware/PageCache.php \Drupal\page_cache\StackMiddleware\PageCache::handle()
  3. 11.x core/modules/page_cache/src/StackMiddleware/PageCache.php \Drupal\page_cache\StackMiddleware\PageCache::handle()

File

core/modules/page_cache/src/StackMiddleware/PageCache.php, line 79

Class

PageCache
Executes the page caching before the main kernel takes over the request.

Namespace

Drupal\page_cache\StackMiddleware

Code

public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) : Response {
    // Only allow page caching on master request.
    if ($type === static::MAIN_REQUEST && $this->requestPolicy
        ->check($request) === RequestPolicyInterface::ALLOW) {
        $response = $this->lookup($request, $type, $catch);
    }
    else {
        $response = $this->pass($request, $type, $catch);
    }
    return $response;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.