public PageCache::handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
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
Response A Response instance
Throws
\Exception When an Exception occurs during processing
Overrides HttpKernelInterface::handle
File
- core/modules/page_cache/src/StackMiddleware/PageCache.php, line 72
Class
- PageCache
- Executes the page caching before the main kernel takes over the request.
Namespace
Drupal\page_cache\StackMiddleware
Code
1 2 3 4 5 6 7 8 9 10 11 | 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 ; } |
Please login to continue.