function PageCache::__construct
Constructs a PageCache object.
Parameters
\Symfony\Component\HttpKernel\HttpKernelInterface|\Closure $http_kernel: The decorated kernel.
\Drupal\Core\Cache\CacheBackendInterface $cache: The cache bin.
\Drupal\Core\PageCache\RequestPolicyInterface $request_policy: A policy rule determining the cacheability of a request.
\Drupal\Core\PageCache\ResponsePolicyInterface $response_policy: A policy rule determining the cacheability of the response.
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\StackMiddlewareCode
public function __construct(HttpKernelInterface|\Closure $http_kernel, CacheBackendInterface $cache, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy) {
if ($http_kernel instanceof HttpKernelInterface) {
@trigger_error('Calling ' . __METHOD__ . '() without a service closure $http_kernel argument is deprecated in drupal:11.3.0 and it will throw an error in drupal:12.0.0. See https://www.drupal.org/node/3538740', E_USER_DEPRECATED);
$http_kernel = static fn() => $http_kernel;
}
$this->httpKernel = $http_kernel;
$this->cache = $cache;
$this->requestPolicy = $request_policy;
$this->responsePolicy = $response_policy;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.