Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Response.php

function 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 response's TTL is 0, the response may not be served from cache without first revalidating with the origin.

@final

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 852

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function getTtl() : ?int {
    $maxAge = $this->getMaxAge();
    return null !== $maxAge ? max($maxAge - $this->getAge(), 0) : null;
}
RSS feed
Powered by Drupal