annotate core/lib/Drupal/Core/PageCache/ResponsePolicyInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\PageCache;
Chris@0 4
Chris@0 5 use Symfony\Component\HttpFoundation\Request;
Chris@0 6 use Symfony\Component\HttpFoundation\Response;
Chris@0 7
Chris@0 8 /**
Chris@0 9 * Defines the interface for response policy implementations.
Chris@0 10 *
Chris@0 11 * The response policy is evaluated in order to determine whether a page should
Chris@0 12 * be stored a in the cache. Calling code should do so unless static::DENY is
Chris@0 13 * returned from the check() method.
Chris@0 14 */
Chris@0 15 interface ResponsePolicyInterface {
Chris@0 16
Chris@0 17 /**
Chris@0 18 * Deny storage of a page in the cache.
Chris@0 19 */
Chris@0 20 const DENY = 'deny';
Chris@0 21
Chris@0 22 /**
Chris@0 23 * Determines whether it is save to store a page in the cache.
Chris@0 24 *
Chris@0 25 * @param \Symfony\Component\HttpFoundation\Response $response
Chris@0 26 * The response which is about to be sent to the client.
Chris@0 27 * @param \Symfony\Component\HttpFoundation\Request $request
Chris@0 28 * The request object.
Chris@0 29 *
Chris@0 30 * @return string|null
Chris@0 31 * Either static::DENY or NULL. Calling code may attempt to store a page in
Chris@0 32 * the cache unless static::DENY is returned. Returns NULL if the policy
Chris@0 33 * policy is not specified for the given response.
Chris@0 34 */
Chris@0 35 public function check(Response $response, Request $request);
Chris@0 36
Chris@0 37 }