DefaultRequestPolicy.php

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

Namespace

Drupal\Core\PageCache

File

core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php

View source
<?php

namespace Drupal\Core\PageCache;

use Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod;
use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
use Drupal\Core\Session\SessionConfigurationInterface;

/**
 * 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.
 */
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));
    }

}

Classes

Title Deprecated Summary
DefaultRequestPolicy The default page cache request policy.

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