PageCache
class PageCache implements HttpKernelInterface (View source)
Executes the page caching before the main kernel takes over the request.
Properties
| protected HttpKernelInterface | $httpKernel | The wrapped HTTP kernel. |
|
| protected CacheBackendInterface | $cache | The cache bin. |
|
| protected RequestPolicyInterface | $requestPolicy | A policy rule determining the cacheability of a request. |
|
| protected ResponsePolicyInterface | $responsePolicy | A policy rule determining the cacheability of the response. |
|
| protected string | $cid | The cache ID for the (master) request. |
Methods
Constructs a PageCache object.
{@inheritdoc}
Sidesteps the page cache and directly forwards a request to the backend.
Retrieves a response from the cache or fetches it from the backend.
Fetches a response from the backend and stores it in the cache.
Stores a response in the page cache.
Returns a response object from the page cache.
Stores a response object in the page cache.
Gets the page cache ID for this request.
Details
__construct(HttpKernelInterface $http_kernel, CacheBackendInterface $cache, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy)
Constructs a PageCache object.
Response
handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
{@inheritdoc}
protected
pass(Request $request, int $type = self::MASTER_REQUEST, bool $catch = TRUE)
Sidesteps the page cache and directly forwards a request to the backend.
protected
lookup(Request $request, int $type = self::MASTER_REQUEST, bool $catch = TRUE)
Retrieves a response from the cache or fetches it from the backend.
protected
fetch(Request $request, int $type = self::MASTER_REQUEST, bool $catch = TRUE)
Fetches a response from the backend and stores it in the cache.
protected
storeResponse(Request $request, Response $response)
Stores a response in the page cache.
protected Response|false
get(Request $request, bool $allow_invalid = FALSE)
Returns a response object from the page cache.
protected
set(Request $request, Response $response, int $expire, array $tags)
Stores a response object in the page cache.
protected string
getCacheId(Request $request)
Gets the page cache ID for this request.