protected function HttpCache::store

Writes the Response to the cache.

Parameters

Request $request A Request instance:

Response $response A Response instance:

2 calls to HttpCache::store()
HttpCache::fetch in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
Forwards the Request to the backend and determines whether the response should be stored.
HttpCache::validate in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
Validates that a cache entry is fresh.

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php, line 553

Class

HttpCache
Cache provides HTTP caching.

Namespace

Symfony\Component\HttpKernel\HttpCache

Code

protected function store(Request $request, Response $response) {
  try {
    $this->store
      ->write($request, $response);
    $this
      ->record($request, 'store');
    $response->headers
      ->set('Age', $response
      ->getAge());
  } catch (\Exception $e) {
    $this
      ->record($request, 'store-failed');
    if ($this->options['debug']) {
      throw $e;
    }
  }

  // now that the response is cached, release the lock
  $this->store
    ->unlock($request);
}