class UrlCacheContext
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php \Drupal\Core\Cache\Context\UrlCacheContext
Defines the UrlCacheContext service, for "per page" caching.
Cache context ID: 'url'.
Hierarchy
- class \Drupal\Core\Cache\Context\RequestStackCacheContextBase
- class \Drupal\Core\Cache\Context\UrlCacheContext extends \Drupal\Core\Cache\Context\CacheContextInterface implements \Drupal\Core\Cache\Context\RequestStackCacheContextBase
Expanded class hierarchy of UrlCacheContext
1 string reference to 'UrlCacheContext'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses UrlCacheContext
File
-
core/
lib/ Drupal/ Core/ Cache/ Context/ UrlCacheContext.php, line 12
Namespace
Drupal\Core\Cache\ContextView source
class UrlCacheContext extends RequestStackCacheContextBase implements CacheContextInterface {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('URL');
}
/**
* {@inheritdoc}
*/
public function getContext() {
return $this->requestStack
->getCurrentRequest()
->getUri();
}
/**
* {@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.