You are here

interface ResponsePolicyInterface in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/PageCache/ResponsePolicyInterface.php \Drupal\Core\PageCache\ResponsePolicyInterface

Defines the interface for response policy implementations.

The response policy is evaluated in order to determine whether a page should be stored a in the cache. Calling code should do so unless static::DENY is returned from the check() method.

Hierarchy

Expanded class hierarchy of ResponsePolicyInterface

All classes that implement ResponsePolicyInterface

12 files declare their use of ResponsePolicyInterface
ChainResponsePolicyTest.php in core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
Contains \Drupal\Tests\Core\PageCache\ChainResponsePolicyTest.
DenyAdminRoutes.php in core/modules/dynamic_page_cache/src/PageCache/ResponsePolicy/DenyAdminRoutes.php
Contains \Drupal\dynamic_page_cache\PageCache\ResponsePolicy\DenyAdminRoutes.
DenyNoCacheRoutes.php in core/lib/Drupal/Core/PageCache/ResponsePolicy/DenyNoCacheRoutes.php
Contains \Drupal\Core\PageCache\ResponsePolicy\DenyNoCacheRoutes.
DenyNodePreview.php in core/modules/node/src/PageCache/DenyNodePreview.php
Contains \Drupal\node\PageCache\DenyNodePreview.
DenyNodePreviewTest.php in core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php
Contains \Drupal\Tests\node\Unit\PageCache\DenyNodePreviewTest.

... See full list

File

core/lib/Drupal/Core/PageCache/ResponsePolicyInterface.php, line 20
Contains \Drupal\Core\PageCache\ResponsePolicyInterface.

Namespace

Drupal\Core\PageCache
View source
interface ResponsePolicyInterface {

  /**
   * Deny storage of a page in the cache.
   */
  const DENY = 'deny';

  /**
   * Determines whether it is save to store a page in the cache.
   *
   * @param \Symfony\Component\HttpFoundation\Response $response
   *   The response which is about to be sent to the client.
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The request object.
   *
   * @return string|NULL
   *   Either static::DENY or NULL. Calling code may attempt to store a page in
   *   the cache unless static::DENY is returned. Returns NULL if the policy
   *   policy is not specified for the given response.
   */
  public function check(Response $response, Request $request);

}

Members

Namesort descending Modifiers Type Description Overrides
ResponsePolicyInterface::check public function Determines whether it is save to store a page in the cache. 8
ResponsePolicyInterface::DENY constant Deny storage of a page in the cache.