DynamicPageCacheSubscriber::$cacheContexts

Same name in other branches
  1. 10 core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php \Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber::cacheContexts

The default cache contexts to vary every cache item by.

Type: string[]

File

core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php, line 69

Class

DynamicPageCacheSubscriber
Returns cached responses as early and avoiding as much work as possible.

Namespace

Drupal\dynamic_page_cache\EventSubscriber

Code

protected $cacheContexts = [
    'route',
    // Some routes' controllers rely on the request format (they don't have
    // a separate route for each request format). Additionally, a controller
    // may be returning a domain object that a KernelEvents::VIEW subscriber
    // must turn into an actual response, but perhaps a format is being
    // requested that the subscriber does not support.
    // @see \Drupal\Core\EventSubscriber\RenderArrayNonHtmlSubscriber::onResponse()
'request_format',
];

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.