class DenyOnCacheControlOverride in Cache Control Override 8
Cache policy for responses that have a bubbled max-age=0.
Hierarchy
- class \Drupal\cache_control_override\PageCache\DenyOnCacheControlOverride implements ResponsePolicyInterface
Expanded class hierarchy of DenyOnCacheControlOverride
1 string reference to 'DenyOnCacheControlOverride'
1 service uses DenyOnCacheControlOverride
File
- src/
PageCache/ DenyOnCacheControlOverride.php, line 13
Namespace
Drupal\cache_control_override\PageCacheView source
class DenyOnCacheControlOverride implements ResponsePolicyInterface {
/**
* {@inheritdoc}
*/
public function check(Response $response, Request $request) {
if (!$response instanceof CacheableResponseInterface) {
return NULL;
}
if ($response
->getCacheableMetadata()
->getCacheMaxAge() === 0) {
// @TODO: This will affect users using Internal Page Cache as well, find a way to document that.
return static::DENY;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DenyOnCacheControlOverride:: |
public | function |
Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface:: |
|
ResponsePolicyInterface:: |
constant | Deny storage of a page in the cache. |