function RequestPolicyInterface::check
Same name in other branches
- 9 core/lib/Drupal/Core/PageCache/RequestPolicyInterface.php \Drupal\Core\PageCache\RequestPolicyInterface::check()
- 10 core/lib/Drupal/Core/PageCache/RequestPolicyInterface.php \Drupal\Core\PageCache\RequestPolicyInterface::check()
- 11.x core/lib/Drupal/Core/PageCache/RequestPolicyInterface.php \Drupal\Core\PageCache\RequestPolicyInterface::check()
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.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The incoming request object.
Return value
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.
6 methods override RequestPolicyInterface::check()
- AllowToolbarPath::check in core/
modules/ toolbar/ src/ PageCache/ AllowToolbarPath.php - Determines whether delivery of a cached page should be attempted.
- ChainRequestPolicy::check in core/
lib/ Drupal/ Core/ PageCache/ ChainRequestPolicy.php - Determines whether delivery of a cached page should be attempted.
- CommandLineOrUnsafeMethod::check in core/
lib/ Drupal/ Core/ PageCache/ RequestPolicy/ CommandLineOrUnsafeMethod.php - Determines whether delivery of a cached page should be attempted.
- DenyTestAuthRequests::check in core/
modules/ rest/ tests/ modules/ rest_test/ src/ PageCache/ RequestPolicy/ DenyTestAuthRequests.php - Determines whether delivery of a cached page should be attempted.
- DisallowBasicAuthRequests::check in core/
modules/ basic_auth/ src/ PageCache/ DisallowBasicAuthRequests.php - Determines whether delivery of a cached page should be attempted.
File
-
core/
lib/ Drupal/ Core/ PageCache/ RequestPolicyInterface.php, line 47
Class
- RequestPolicyInterface
- Defines the interface for request policy implementations.
Namespace
Drupal\Core\PageCacheCode
public function check(Request $request);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.