Version 1
[yaffs-website] / web / core / modules / dynamic_page_cache / src / PageCache / RequestPolicy / DefaultRequestPolicy.php
diff --git a/web/core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php b/web/core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php
new file mode 100644 (file)
index 0000000..7b894a6
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace Drupal\dynamic_page_cache\PageCache\RequestPolicy;
+
+use Drupal\Core\PageCache\ChainRequestPolicy;
+use Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod;
+
+/**
+ * The default Dynamic 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).
+ */
+class DefaultRequestPolicy extends ChainRequestPolicy {
+
+  /**
+   * Constructs the default Dynamic Page Cache request policy.
+   */
+  public function __construct() {
+    $this->addPolicy(new CommandLineOrUnsafeMethod());
+  }
+
+}