class UserCacheContext
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Cache/Context/UserCacheContext.php \Drupal\Core\Cache\Context\UserCacheContext
Defines the UserCacheContext service, for "per user" caching.
Cache context ID: 'user'.
Hierarchy
- class \Drupal\Core\Cache\Context\UserCacheContextBase
- class \Drupal\Core\Cache\Context\UserCacheContext extends \Drupal\Core\Cache\Context\CacheContextInterface implements \Drupal\Core\Cache\Context\UserCacheContextBase
Expanded class hierarchy of UserCacheContext
1 string reference to 'UserCacheContext'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses UserCacheContext
File
-
core/
lib/ Drupal/ Core/ Cache/ Context/ UserCacheContext.php, line 12
Namespace
Drupal\Core\Cache\ContextView source
class UserCacheContext extends UserCacheContextBase implements CacheContextInterface {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('User');
}
/**
* {@inheritdoc}
*/
public function getContext() {
return $this->user
->id();
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata() {
return new CacheableMetadata();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.