3 namespace Drupal\Core\PageCache;
5 use Symfony\Component\HttpFoundation\Request;
8 * Defines the interface for request policy implementations.
10 * The request policy is evaluated in order to determine whether delivery of a
11 * cached page should be attempted. The caller should do so if static::ALLOW is
12 * returned from the check() method.
14 interface RequestPolicyInterface {
17 * Allow delivery of cached pages.
19 const ALLOW = 'allow';
22 * Deny delivery of cached pages.
27 * Determines whether delivery of a cached page should be attempted.
29 * Note that the request-policy check runs very early. In particular it is
30 * not possible to determine the logged in user. Also the current route match
31 * is not yet present when the check runs. Therefore, request-policy checks
32 * need to be designed in a way such that they do not depend on any other
33 * service and only take in account the information present on the incoming
36 * When matching against the request path, special attention is needed to
37 * support path prefixes which are often used on multilingual sites.
39 * @param \Symfony\Component\HttpFoundation\Request $request
40 * The incoming request object.
43 * One of static::ALLOW, static::DENY or NULL. Calling code may attempt to
44 * deliver a cached page if static::ALLOW is returned. Returns NULL if the
45 * policy is not specified for the given request.
47 public function check(Request $request);