You are here

protected function PageCache::set in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/page_cache/src/StackMiddleware/PageCache.php \Drupal\page_cache\StackMiddleware\PageCache::set()

Stores a response object in the page cache.

Parameters

\Symfony\Component\HttpFoundation\Request $request: A request object.

\Symfony\Component\HttpFoundation\Response $response: The response to store in the cache.

int $expire: One of the following values:

  • CacheBackendInterface::CACHE_PERMANENT: Indicates that the item should not be removed unless it is deleted explicitly.
  • A Unix timestamp: Indicates that the item will be considered invalid after this time, i.e. it will not be returned by get() unless $allow_invalid has been set to TRUE. When the item has expired, it may be permanently deleted by the garbage collector at any time.

array $tags: An array of tags to be stored with the cache item. These should normally identify objects used to build the cache item, which should trigger cache invalidation when updated. For example if a cached item represents a node, both the node ID and the author's user ID might be passed in as tags. For example array('node' => array(123), 'user' => array(92)).

1 call to PageCache::set()
PageCache::fetch in core/modules/page_cache/src/StackMiddleware/PageCache.php
Fetches a response from the backend and stores it in the cache.

File

core/modules/page_cache/src/StackMiddleware/PageCache.php, line 313
Contains \Drupal\page_cache\StackMiddleware\PageCache.

Class

PageCache
Executes the page caching before the main kernel takes over the request.

Namespace

Drupal\page_cache\StackMiddleware

Code

protected function set(Request $request, Response $response, $expire, array $tags) {
  $cid = $this
    ->getCacheId($request);
  $this->cache
    ->set($cid, $response, $expire, $tags);
}