public function Response::isCacheable in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::isCacheable()
Returns true if the response is worth caching under any circumstance.
Responses marked "private" with an explicit Cache-Control directive are considered uncacheable.
Responses with neither a freshness lifetime (Expires, max-age) nor cache validator (Last-Modified, ETag) are considered uncacheable.
Return value
bool true if the response is worth caching, false otherwise
File
- vendor/
symfony/ http-foundation/ Response.php, line 519
Class
- Response
- Response represents an HTTP response.
Namespace
Symfony\Component\HttpFoundationCode
public function isCacheable() {
if (!in_array($this->statusCode, array(
200,
203,
300,
301,
302,
404,
410,
))) {
return false;
}
if ($this->headers
->hasCacheControlDirective('no-store') || $this->headers
->getCacheControlDirective('private')) {
return false;
}
return $this
->isValidateable() || $this
->isFresh();
}