interface RequestPolicyInterface in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/PageCache/RequestPolicyInterface.php \Drupal\Core\PageCache\RequestPolicyInterface
Defines the interface for request policy implementations.
The request policy is evaluated in order to determine whether delivery of a cached page should be attempted. The caller should do so if static::ALLOW is returned from the check() method.
Hierarchy
- interface \Drupal\Core\PageCache\RequestPolicyInterface
Expanded class hierarchy of RequestPolicyInterface
All classes that implement RequestPolicyInterface
13 files declare their use of RequestPolicyInterface
- AllowToolbarPath.php in core/
modules/ toolbar/ src/ PageCache/ AllowToolbarPath.php - Contains \Drupal\toolbar\PageCache\AllowToolbarPath.
- AllowToolbarPathTest.php in core/
modules/ toolbar/ tests/ src/ Unit/ PageCache/ AllowToolbarPathTest.php - Contains \Drupal\Tests\toolbar\Unit\PageCache\AllowToolbarPathTest.
- ChainRequestPolicyTest.php in core/
tests/ Drupal/ Tests/ Core/ PageCache/ ChainRequestPolicyTest.php - Contains \Drupal\Tests\Core\PageCache\ChainRequestPolicyTest.
- CommandLineOrUnsafeMethod.php in core/
lib/ Drupal/ Core/ PageCache/ RequestPolicy/ CommandLineOrUnsafeMethod.php - Contains \Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod.
- CommandLineOrUnsafeMethodTest.php in core/
tests/ Drupal/ Tests/ Core/ PageCache/ CommandLineOrUnsafeMethodTest.php - Contains \Drupal\Tests\Core\PageCache\CommandLineOrUnsafeMethodTest.
File
- core/
lib/ Drupal/ Core/ PageCache/ RequestPolicyInterface.php, line 19 - Contains \Drupal\Core\PageCache\RequestPolicyInterface.
Namespace
Drupal\Core\PageCacheView source
interface RequestPolicyInterface {
/**
* Allow delivery of cached pages.
*/
const ALLOW = 'allow';
/**
* Deny delivery of cached pages.
*/
const DENY = 'deny';
/**
* Determines whether delivery of a cached page should be attempted.
*
* Note that the request-policy check runs very early. In particular it is
* not possible to determine the logged in user. Also the current route match
* is not yet present when the check runs. Therefore, request-policy checks
* need to be designed in a way such that they do not depend on any other
* service and only take in account the information present on the incoming
* request.
*
* When matching against the request path, special attention is needed to
* support path prefixes which are often used on multilingual sites.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The incoming request object.
*
* @return string|NULL
* One of static::ALLOW, static::DENY or NULL. Calling code may attempt to
* deliver a cached page if static::ALLOW is returned. Returns NULL if the
* policy is not specified for the given request.
*/
public function check(Request $request);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RequestPolicyInterface:: |
constant | Allow delivery of cached pages. | ||
RequestPolicyInterface:: |
public | function | Determines whether delivery of a cached page should be attempted. | 5 |
RequestPolicyInterface:: |
constant | Deny delivery of cached pages. |