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

Breadcrumb

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

function Response::setStaleWhileRevalidate

Sets the number of seconds after which the response should no longer return stale content by shared caches.

This method sets the Cache-Control stale-while-revalidate directive.

@final

Return value

$this

1 call to Response::setStaleWhileRevalidate()
Response::setCache in vendor/symfony/http-foundation/Response.php
Sets the response's cache headers (validation and/or expiration).

File

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

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setStaleWhileRevalidate(int $value) : static {
    $this->headers
        ->addCacheControlDirective('stale-while-revalidate', $value);
    return $this;
}
RSS feed
Powered by Drupal