Drupal 8  8.0.2
PageCache Class Reference
Inheritance diagram for PageCache:

Public Member Functions

 __construct (HttpKernelInterface $http_kernel, CacheBackendInterface $cache, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy)
 
 handle (Request $request, $type=self::MASTER_REQUEST, $catch=TRUE)
 

Protected Member Functions

 pass (Request $request, $type=self::MASTER_REQUEST, $catch=TRUE)
 
 lookup (Request $request, $type=self::MASTER_REQUEST, $catch=TRUE)
 
 get (Request $request, $allow_invalid=FALSE)
 
 set (Request $request, Response $response, $expire, array $tags)
 
 getCacheId (Request $request)
 

Protected Attributes

 $httpKernel
 
 $cache
 
 $requestPolicy
 
 $responsePolicy
 

Detailed Description

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

Constructor & Destructor Documentation

__construct ( HttpKernelInterface  $http_kernel,
CacheBackendInterface  $cache,
RequestPolicyInterface  $request_policy,
ResponsePolicyInterface  $response_policy 
)

Constructs a PageCache object.

Parameters
\Symfony\Component\HttpKernel\HttpKernelInterface$http_kernelThe decorated kernel.
\Drupal\Core\Cache\CacheBackendInterface$cacheThe cache bin.
\Drupal\Core\PageCache\RequestPolicyInterface$request_policyA policy rule determining the cacheability of a request.
\Drupal\Core\PageCache\ResponsePolicyInterface$response_policyA policy rule determining the cacheability of the response.

References Drupal\cache().

Here is the call graph for this function:

Member Function Documentation

get ( Request  $request,
  $allow_invalid = FALSE 
)
protected

Returns a response object from the page cache.

Parameters
\Symfony\Component\HttpFoundation\Request$requestA request object.
bool$allow_invalid(optional) If TRUE, a cache item may be returned even if it is expired or has been invalidated. Such items may sometimes be preferred, if the alternative is recalculating the value stored in the cache, especially if another concurrent request is already recalculating the same value. The "valid" property of the returned object indicates whether the item is valid or not. Defaults to FALSE.
Returns
|false The cached response or FALSE on failure.

References Drupal\cache(), and PageCache\getCacheId().

Here is the call graph for this function:

getCacheId ( Request  $request)
protected

Gets the page cache ID for this request.

Parameters
\Symfony\Component\HttpFoundation\Request$requestA request object.
Returns
string The cache ID for this request.

Referenced by PageCache\get(), and PageCache\set().

Here is the caller graph for this function:

handle ( Request  $request,
  $type = self::MASTER_REQUEST,
  $catch = TRUE 
)

{}

References RequestPolicyInterface\ALLOW, PageCache\lookup(), and PageCache\pass().

Here is the call graph for this function:

lookup ( Request  $request,
  $type = self::MASTER_REQUEST,
  $catch = TRUE 
)
protected

Retrieves a response from the cache or fetches it from the backend.

Parameters
\Symfony\Component\HttpFoundation\Request$requestA request object.
int$typeThe type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
bool$catchWhether to catch exceptions or not
Returns
$response A response object.

Referenced by PageCache\handle().

Here is the caller graph for this function:

pass ( Request  $request,
  $type = self::MASTER_REQUEST,
  $catch = TRUE 
)
protected

Sidesteps the page cache and directly forwards a request to the backend.

Parameters
\Symfony\Component\HttpFoundation\Request$requestA request object.
int$typeThe type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
bool$catchWhether to catch exceptions or not
Returns
$response A response object.

Referenced by PageCache\handle().

Here is the caller graph for this function:

set ( Request  $request,
Response  $response,
  $expire,
array  $tags 
)
protected

Stores a response object in the page cache.

Parameters
\Symfony\Component\HttpFoundation\Request$requestA request object.
\Symfony\Component\HttpFoundation\Response$responseThe response to store in the cache.
int$expireOne of the following values:
  • CacheBackendInterface::CACHE_PERMANENT: Indicates that the item should not be removed unless it is deleted explicitly.
  • A Unix timestamp: Indicates that the item will be considered invalid after this time, i.e. it will not be returned by get() unless $allow_invalid has been set to TRUE. When the item has expired, it may be permanently deleted by the garbage collector at any time.
array$tagsAn array of tags to be stored with the cache item. These should normally identify objects used to build the cache item, which should trigger cache invalidation when updated. For example if a cached item represents a node, both the node ID and the author's user ID might be passed in as tags. For example array('node' => array(123), 'user' => array(92)).

References Drupal\cache(), and PageCache\getCacheId().

Here is the call graph for this function:


The documentation for this class was generated from the following file: