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

Breadcrumb

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

function Response::setStaleIfError

Sets the number of seconds after which the response should no longer be returned by shared caches when backend is down.

This method sets the Cache-Control stale-if-error directive.

@final

Return value

$this

1 call to Response::setStaleIfError()
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 802

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

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