Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ResponsePolicyInterface.php

interface ResponsePolicyInterface

Defines the interface for response policy implementations.

The response policy is evaluated in order to determine whether a page should be stored in the cache. Calling code should do so unless static::DENY is returned from the check() method.

Hierarchy

  • interface \Drupal\Core\PageCache\ResponsePolicyInterface

Expanded class hierarchy of ResponsePolicyInterface

All classes that implement ResponsePolicyInterface

9 files declare their use of ResponsePolicyInterface
DenyAdminRoutes.php in core/modules/dynamic_page_cache/src/PageCache/ResponsePolicy/DenyAdminRoutes.php
DenyNoCacheRoutes.php in core/lib/Drupal/Core/PageCache/ResponsePolicy/DenyNoCacheRoutes.php
DenyNodePreview.php in core/modules/node/src/PageCache/DenyNodePreview.php
DenyPrivateImageStyleDownload.php in core/modules/image/src/PageCache/DenyPrivateImageStyleDownload.php
DynamicPageCacheSubscriber.php in core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php

... See full list

File

core/lib/Drupal/Core/PageCache/ResponsePolicyInterface.php, line 15

Namespace

Drupal\Core\PageCache
View source
interface ResponsePolicyInterface {
    
    /**
     * Deny storage of a page in the cache.
     */
    const DENY = 'deny';
    
    /**
     * Determines whether it is save to store a page in the cache.
     *
     * @param \Symfony\Component\HttpFoundation\Response $response
     *   The response which is about to be sent to the client.
     * @param \Symfony\Component\HttpFoundation\Request $request
     *   The request object.
     *
     * @return string|null
     *   Either static::DENY or NULL. Calling code may attempt to store a page in
     *   the cache unless static::DENY is returned. Returns NULL if the policy
     *   policy is not specified for the given response.
     */
    public function check(Response $response, Request $request);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ResponsePolicyInterface::check public function Determines whether it is save to store a page in the cache. 8
ResponsePolicyInterface::DENY constant Deny storage of a page in the cache.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal