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

Breadcrumb

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

function Response::setSharedMaxAge

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

This method sets the Cache-Control s-maxage directive.

@final

Return value

$this

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

File

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

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setSharedMaxAge(int $value) : static {
    $this->setPublic();
    $this->headers
        ->addCacheControlDirective('s-maxage', $value);
    return $this;
}
RSS feed
Powered by Drupal