Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Cache / Context / SessionCacheContext.php
1 <?php
2
3 namespace Drupal\Core\Cache\Context;
4
5 use Drupal\Component\Utility\Crypt;
6
7 /**
8  * Defines the SessionCacheContext service, for "per session" caching.
9  *
10  * Cache context ID: 'session'.
11  */
12 class SessionCacheContext extends RequestStackCacheContextBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static function getLabel() {
18     return t('Session');
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function getContext() {
25     $sid = $this->requestStack->getCurrentRequest()->getSession()->getId();
26     return Crypt::hashBase64($sid);
27   }
28
29 }