Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SessionCacheContext.php

class 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

File

core/lib/Drupal/Core/Cache/Context/SessionCacheContext.php, line 12

Namespace

Drupal\Core\Cache\Context
View 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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal