Created
December 3, 2019 18:03
-
-
Save PSF1/60df9acc53f48f6a8098ad8b1b92fcf6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Drupal\Core\PageCache\ResponsePolicy\KillSwitch | |
class ... | |
/** | |
* Kill cache service. | |
* | |
* @var \Drupal\Core\PageCache\ResponsePolicy\KillSwitch | |
*/ | |
protected $killSwitch; | |
/** | |
* {@inheritdoc} | |
*/ | |
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { | |
return new static( | |
... | |
$container->get('page_cache_kill_switch'), | |
... | |
); | |
} | |
... | |
/** | |
* Constructs a new GetReservableAvailabilityToDayRestResource object. | |
* | |
* @param \Drupal\Core\PageCache\ResponsePolicy\KillSwitch $killSwitch | |
* The cache killer. | |
*/ | |
public function __construct( | |
KillSwitch $killSwitch | |
) { | |
... | |
$this->killSwitch = $killSwitch; | |
... | |
} | |
... | |
public function loginSwitcher() { | |
... | |
// Don't allow cache this response. | |
$this->killSwitch->trigger(); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment