You are here

class DefaultRequestPolicy in Drupal 10

Same name in this branch
  1. 10 core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php \Drupal\Core\PageCache\DefaultRequestPolicy
  2. 10 core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php \Drupal\dynamic_page_cache\PageCache\RequestPolicy\DefaultRequestPolicy
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php \Drupal\Core\PageCache\DefaultRequestPolicy
  2. 9 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

  • class \Drupal\Core\PageCache\DefaultRequestPolicy extends \Drupal\Core\PageCache\ChainRequestPolicy

Expanded class hierarchy of DefaultRequestPolicy

1 string reference to 'DefaultRequestPolicy'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses DefaultRequestPolicy
page_cache_request_policy in core/core.services.yml
Drupal\Core\PageCache\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