class DefaultRequestPolicy

Same name in this branch
  1. 11.x core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php \Drupal\dynamic_page_cache\PageCache\RequestPolicy\DefaultRequestPolicy
Same name in other branches
  1. 9 core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php \Drupal\dynamic_page_cache\PageCache\RequestPolicy\DefaultRequestPolicy
  2. 9 core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php \Drupal\Core\PageCache\DefaultRequestPolicy
  3. 8.9.x core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php \Drupal\dynamic_page_cache\PageCache\RequestPolicy\DefaultRequestPolicy
  4. 8.9.x core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php \Drupal\Core\PageCache\DefaultRequestPolicy
  5. 10 core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php \Drupal\dynamic_page_cache\PageCache\RequestPolicy\DefaultRequestPolicy
  6. 10 core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php \Drupal\Core\PageCache\DefaultRequestPolicy

The default page cache request policy.

Delivery of cached pages is denied if either the application is running from the command line or the request was not initiated with a safe method (GET or HEAD). Also caching is only allowed for requests without a session cookie.

Hierarchy

Expanded class hierarchy of DefaultRequestPolicy

File

core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php, line 16

Namespace

Drupal\Core\PageCache
View source
class DefaultRequestPolicy extends ChainRequestPolicy {
    
    /**
     * Constructs the default page cache request policy.
     *
     * @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration
     *   The session configuration.
     */
    public function __construct(SessionConfigurationInterface $session_configuration) {
        $this->addPolicy(new CommandLineOrUnsafeMethod());
        $this->addPolicy(new NoSessionOpen($session_configuration));
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
ChainRequestPolicy::$rules protected property A list of policy rules to apply when this policy is evaluated.
ChainRequestPolicy::addPolicy public function Overrides ChainRequestPolicyInterface::addPolicy
ChainRequestPolicy::check public function Overrides RequestPolicyInterface::check
DefaultRequestPolicy::__construct public function Constructs the default page cache request policy.
RequestPolicyInterface::ALLOW constant Allow delivery of cached pages.
RequestPolicyInterface::DENY constant Deny delivery of cached pages.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.