public function Response::isFresh

Same name in this branch

Returns true if the response is "fresh".

Fresh responses may be served from cache without any interaction with the origin. A response is considered fresh when it includes a Cache-Control/max-age indicator or Expiration header and the calculated age is less than the freshness lifetime.

@api

Return value

Boolean true if the response is fresh, false otherwise

2 calls to Response::isFresh()
Response::expire in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php
Marks the response stale by setting the Age header to be equal to the maximum age of the response.
Response::isCacheable in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php
Returns true if the response is worth caching under any circumstance.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php, line 497

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function isFresh() {
  return $this
    ->getTtl() > 0;
}