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

Breadcrumb

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

function Response::setMaxAge

Sets the number of seconds after which the response should no longer be considered fresh.

This method sets the Cache-Control max-age directive.

@final

Return value

$this

2 calls to Response::setMaxAge()
Response::setCache in vendor/symfony/http-foundation/Response.php
Sets the response's cache headers (validation and/or expiration).
Response::setClientTtl in vendor/symfony/http-foundation/Response.php
Sets the response's time-to-live for private/client caches in seconds.

File

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

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setMaxAge(int $value) : static {
    $this->headers
        ->addCacheControlDirective('max-age', $value);
    return $this;
}
RSS feed
Powered by Drupal