You are here

protected function FinishResponseSubscriber::setCacheControlNoCache in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php \Drupal\Core\EventSubscriber\FinishResponseSubscriber::setCacheControlNoCache()

Disable caching in the browser and for HTTP/1.1 proxies and clients.

Parameters

\Symfony\Component\HttpFoundation\Response $response: A response object.

1 call to FinishResponseSubscriber::setCacheControlNoCache()
FinishResponseSubscriber::setResponseNotCacheable in core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
Add Cache-Control and Expires headers to a response which is not cacheable.

File

core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php, line 265
Contains \Drupal\Core\EventSubscriber\FinishResponseSubscriber.

Class

FinishResponseSubscriber
Response subscriber to handle finished responses.

Namespace

Drupal\Core\EventSubscriber

Code

protected function setCacheControlNoCache(Response $response) {
  $response->headers
    ->set('Cache-Control', 'no-cache, must-revalidate, post-check=0, pre-check=0');
}