class MyCache in Visually Impaired Support (module) 8
Extending PageCache.
Hierarchy
Expanded class hierarchy of MyCache
File
- src/
StackMiddleware/ MyCache.php, line 11
Namespace
Drupal\visually_impaired_module\StackMiddlewareView source
class MyCache extends PageCache {
/**
* Gets the page cache ID for this request.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* A request object.
*
* @return string
* The cache ID for this request.
*/
protected function getCacheId(Request $request) {
$cookie = '';
if (isset($_COOKIE['visually_impaired'])) {
$cookie = $_COOKIE['visually_impaired'];
}
$cid_parts = [
$cookie,
$request
->getSchemeAndHttpHost() . $request
->getRequestUri(),
$request
->getRequestFormat(),
];
return implode(':', $cid_parts);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MyCache:: |
protected | function |
Gets the page cache ID for this request. Overrides PageCache:: |
|
PageCache:: |
protected | property | The cache bin. | |
PageCache:: |
protected | property | The cache ID for the (master) request. | |
PageCache:: |
protected | property | The wrapped HTTP kernel. | |
PageCache:: |
protected | property | A policy rule determining the cacheability of a request. | |
PageCache:: |
protected | property | A policy rule determining the cacheability of the response. | |
PageCache:: |
protected | function | Fetches a response from the backend and stores it in the cache. | |
PageCache:: |
protected | function | Returns a response object from the page cache. | |
PageCache:: |
public | function | Handles a Request to convert it to a Response. | |
PageCache:: |
protected | function | Retrieves a response from the cache or fetches it from the backend. | |
PageCache:: |
protected | function | Sidesteps the page cache and directly forwards a request to the backend. | |
PageCache:: |
protected | function | Stores a response object in the page cache. | |
PageCache:: |
protected | function | Stores a response in the page cache. | |
PageCache:: |
public | function | Constructs a PageCache object. |