3 namespace Drupal\Core\Cache\Context;
5 use Drupal\Component\Utility\Crypt;
8 * Defines the SessionCacheContext service, for "per session" caching.
10 * Cache context ID: 'session'.
12 class SessionCacheContext extends RequestStackCacheContextBase {
17 public static function getLabel() {
24 public function getContext() {
25 $request = $this->requestStack->getCurrentRequest();
26 if ($request->hasSession()) {
27 return Crypt::hashBase64($request->getSession()->getId());