class KillSwitch

Same name in other branches
  1. 9 core/lib/Drupal/Core/PageCache/ResponsePolicy/KillSwitch.php \Drupal\Core\PageCache\ResponsePolicy\KillSwitch
  2. 8.9.x core/lib/Drupal/Core/PageCache/ResponsePolicy/KillSwitch.php \Drupal\Core\PageCache\ResponsePolicy\KillSwitch
  3. 11.x core/lib/Drupal/Core/PageCache/ResponsePolicy/KillSwitch.php \Drupal\Core\PageCache\ResponsePolicy\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

2 files declare their use of KillSwitch
Messenger.php in core/lib/Drupal/Core/Messenger/Messenger.php
SystemTestController.php in core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
1 string reference to 'KillSwitch'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses KillSwitch
page_cache_kill_switch in core/core.services.yml
Drupal\Core\PageCache\ResponsePolicy\KillSwitch

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
KillSwitch::$kill protected property A flag indicating whether the kill switch was triggered.
KillSwitch::check public function
KillSwitch::trigger public function Deny any page caching on the current request.

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