3 namespace Drupal\Core\PageCache;
5 use Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod;
6 use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
7 use Drupal\Core\Session\SessionConfigurationInterface;
10 * The default page cache request policy.
12 * Delivery of cached pages is denied if either the application is running from
13 * the command line or the request was not initiated with a safe method (GET or
14 * HEAD). Also caching is only allowed for requests without a session cookie.
16 class DefaultRequestPolicy extends ChainRequestPolicy {
19 * Constructs the default page cache request policy.
21 * @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration
22 * The session configuration.
24 public function __construct(SessionConfigurationInterface $session_configuration) {
25 $this->addPolicy(new CommandLineOrUnsafeMethod());
26 $this->addPolicy(new NoSessionOpen($session_configuration));