class SessionCacheContext
Same name in other branches
- 9 core/lib/Drupal/Core/Cache/Context/SessionCacheContext.php \Drupal\Core\Cache\Context\SessionCacheContext
- 8.9.x core/lib/Drupal/Core/Cache/Context/SessionCacheContext.php \Drupal\Core\Cache\Context\SessionCacheContext
- 10 core/lib/Drupal/Core/Cache/Context/SessionCacheContext.php \Drupal\Core\Cache\Context\SessionCacheContext
Defines the SessionCacheContext service, for "per session" caching.
Cache context ID: 'session'.
Hierarchy
- class \Drupal\Core\Cache\Context\RequestStackCacheContextBase
- class \Drupal\Core\Cache\Context\SessionCacheContext extends \Drupal\Core\Cache\Context\RequestStackCacheContextBase
Expanded class hierarchy of SessionCacheContext
1 file declares its use of SessionCacheContext
- SessionCacheContextTest.php in core/
tests/ Drupal/ Tests/ Core/ Cache/ Context/ SessionCacheContextTest.php
File
-
core/
lib/ Drupal/ Core/ Cache/ Context/ SessionCacheContext.php, line 12
Namespace
Drupal\Core\Cache\ContextView source
class SessionCacheContext extends RequestStackCacheContextBase {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('Session');
}
/**
* {@inheritdoc}
*/
public function getContext() {
return Crypt::hashBase64($this->requestStack
->getSession()
->getId());
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
RequestStackCacheContextBase::$requestStack | protected | property | The request stack. |
RequestStackCacheContextBase::__construct | public | function | Constructs a new RequestStackCacheContextBase class. |
SessionCacheContext::getContext | public | function | |
SessionCacheContext::getLabel | public static | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.