class NoOptimizeCacheContext
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\NoOptimizeCacheContext
- 10 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\NoOptimizeCacheContext
- 11.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\NoOptimizeCacheContext
Non-optimizable context class.
Hierarchy
- class \Drupal\Tests\Core\Cache\Context\NoOptimizeCacheContext implements \Drupal\Core\Cache\Context\CacheContextInterface
Expanded class hierarchy of NoOptimizeCacheContext
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ Context/ CacheContextsManagerTest.php, line 283
Namespace
Drupal\Tests\Core\Cache\ContextView source
class NoOptimizeCacheContext implements CacheContextInterface {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return 'Foo';
}
/**
* {@inheritdoc}
*/
public function getContext() {
return 'bar';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata() {
$cacheable_metadata = new CacheableMetadata();
return $cacheable_metadata->setCacheMaxAge(0);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
NoOptimizeCacheContext::getCacheableMetadata | public | function | Gets the cacheability metadata for the context. | Overrides CacheContextInterface::getCacheableMetadata |
NoOptimizeCacheContext::getContext | public | function | Returns the string representation of the cache context. | Overrides CacheContextInterface::getContext |
NoOptimizeCacheContext::getLabel | public static | function | Returns the label of the cache context. | Overrides CacheContextInterface::getLabel |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.