CacheContextsManager

Converts cache context tokens into cache keys.

Uses cache context services (services tagged with 'cache.context', and whose service ID has the 'cache_context.' prefix) to dynamically generate cache keys based on the request context, thus allowing developers to express the state by which should varied (the current URL, language, and so on).

Note that this maps exactly to HTTP's Vary header semantics: @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44

Hierarchy

See also

\Drupal\Core\Cache\Context\CacheContextInterface

\Drupal\Core\Cache\Context\CalculatedCacheContextInterface

\Drupal\Core\Cache\Context\CacheContextsPass

File

core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php, line 23

Namespace

Drupal\Core\Cache\Context

Members

Name Modifiers Type Description
CacheContextsManager::$container protected property The service container.
CacheContextsManager::$contexts protected property Available cache context IDs and corresponding labels.
CacheContextsManager::assertValidTokens public function Asserts the context tokens are valid
CacheContextsManager::convertTokensToKeys public function Converts cache context tokens to cache keys.
CacheContextsManager::getAll public function Provides an array of available cache contexts.
CacheContextsManager::getLabels public function Provides an array of available cache context labels.
CacheContextsManager::getService protected function Retrieves a cache context service from the container.
CacheContextsManager::optimizeTokens public function Optimizes cache context tokens (the minimal representative subset).
CacheContextsManager::parseTokens public static function Parses cache context tokens into context IDs and optional parameters.
CacheContextsManager::validateTokens public function Validates an array of cache context tokens.
CacheContextsManager::__construct public function Constructs a CacheContextsManager object.
doc_Drupal
2016-10-29 08:49:26
Comments
Leave a Comment

Please login to continue.