public function Response::getAge

Same name in this branch

Get the Age HTTP header

Parameters

bool $headerOnly Set to TRUE to only retrieve the Age header rather than calculating the age:

Return value

integer|null Returns the age the object has been in a proxy cache in seconds.

1 call to Response::getAge()
Response::getFreshness in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/Response.php
Get the freshness of the response by returning the difference of the maximum lifetime of the response and the age of the response (max-age - age).

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Message/Response.php, line 384

Class

Response
Guzzle HTTP response object

Namespace

Guzzle\Http\Message

Code

public function getAge($headerOnly = false) {
  $age = $this
    ->getHeader('Age', true);
  if (!$headerOnly && $age === null && $this
    ->getDate()) {
    $age = time() - strtotime($this
      ->getDate());
  }
  return $age;
}