You are here

public function Response::getTtl in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::getTtl()

Returns the response's time-to-live in seconds.

It returns null when no freshness information is present in the response.

When the responses TTL is <= 0, the response may not be served from cache without first revalidating with the origin.

Return value

int|null The TTL in seconds

1 call to Response::getTtl()
Response::isFresh in vendor/symfony/http-foundation/Response.php
Returns true if the response is "fresh".

File

vendor/symfony/http-foundation/Response.php, line 761

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function getTtl() {
  if (null !== ($maxAge = $this
    ->getMaxAge())) {
    return $maxAge - $this
      ->getAge();
  }
}