class KillSwitch in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/PageCache/ResponsePolicy/KillSwitch.php \Drupal\Core\PageCache\ResponsePolicy\KillSwitch
- 9 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 ResponsePolicyInterface
Expanded class hierarchy of KillSwitch
1 file declares its use of KillSwitch
- Messenger.php in core/lib/ Drupal/ Core/ Messenger/ Messenger.php 
1 string reference to 'KillSwitch'
- core.services.yml in core/core.services.yml 
- core/core.services.yml
1 service uses KillSwitch
File
- core/lib/ Drupal/ Core/ PageCache/ ResponsePolicy/ KillSwitch.php, line 12 
Namespace
Drupal\Core\PageCache\ResponsePolicyView 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
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| KillSwitch:: | protected | property | A flag indicating whether the kill switch was triggered. | |
| KillSwitch:: | public | function | Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface:: | |
| KillSwitch:: | public | function | Deny any page caching on the current request. | |
| ResponsePolicyInterface:: | constant | Deny storage of a page in the cache. | 
