/Drupal 8

class 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


See also





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




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.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.