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

Breadcrumb

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

class KillSwitch

A policy evaluating to static::DENY when the kill switch was triggered.

Hierarchy

  • class \Drupal\Core\PageCache\ResponsePolicy\KillSwitch implements \Drupal\Core\PageCache\ResponsePolicyInterface

Expanded class hierarchy of KillSwitch

1 file declares its use of KillSwitch
Messenger.php in core/lib/Drupal/Core/Messenger/Messenger.php

File

core/lib/Drupal/Core/PageCache/ResponsePolicy/KillSwitch.php, line 12

Namespace

Drupal\Core\PageCache\ResponsePolicy
View source
class KillSwitch implements ResponsePolicyInterface {
    
    /**
     * A flag indicating whether the kill switch was triggered.
     *
     * @var bool
     */
    protected $kill = FALSE;
    
    /**
     * {@inheritdoc}
     */
    public function check(Response $response, Request $request) {
        if ($this->kill) {
            return static::DENY;
        }
    }
    
    /**
     * Deny any page caching on the current request.
     */
    public function trigger() {
        $this->kill = TRUE;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
KillSwitch::$kill protected property A flag indicating whether the kill switch was triggered.
KillSwitch::check public function Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface::check
KillSwitch::trigger public function Deny any page caching on the current request.
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