public function PageCache::handle in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/page_cache/src/StackMiddleware/PageCache.php \Drupal\page_cache\StackMiddleware\PageCache::handle()
Handles a Request to convert it to a Response.
When $catch is true, the implementation must catch all exceptions and do its best to convert them to a Response instance.
Parameters
Request $request A Request instance:
int $type The type of the request: (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
bool $catch Whether to catch exceptions or not:
Return value
Throws
\Exception When an Exception occurs during processing
Overrides HttpKernelInterface::handle
File
- core/
modules/ page_cache/ src/ StackMiddleware/ PageCache.php, line 76 - Contains \Drupal\page_cache\StackMiddleware\PageCache.
Class
- PageCache
- Executes the page caching before the main kernel takes over the request.
Namespace
Drupal\page_cache\StackMiddlewareCode
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
// Only allow page caching on master request.
if ($type === static::MASTER_REQUEST && $this->requestPolicy
->check($request) === RequestPolicyInterface::ALLOW) {
$response = $this
->lookup($request, $type, $catch);
}
else {
$response = $this
->pass($request, $type, $catch);
}
return $response;
}