private function ApeSubscriber::checkCacheable in Advanced Page Expiration 8
Final cache check to respect defined cache policies and max age.
Parameters
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event: The event to process.
int $maxAge: The cache expiration age, in seconds.
Return value
bool True if caching policies allow caching and max age is greater than 0, false if not.
1 call to ApeSubscriber::checkCacheable()
- ApeSubscriber::setCacheHeader in src/
EventSubscriber/ ApeSubscriber.php - Sets the cache control header.
File
- src/
EventSubscriber/ ApeSubscriber.php, line 147
Class
- ApeSubscriber
- Alter Cache-control header based on configuration of ape.
Namespace
Drupal\ape\EventSubscriberCode
private function checkCacheable(FilterResponseEvent $event, $maxAge) {
$request = $event
->getRequest();
$response = $event
->getResponse();
$isCacheable = $this->requestPolicy
->check($request) === RequestPolicyInterface::ALLOW && $this->responsePolicy
->check($response, $request) !== ResponsePolicyInterface::DENY;
return $isCacheable && $maxAge > 0 ? TRUE : FALSE;
}