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