function NoOptimizeCacheContext::getCacheableMetadata

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\NoOptimizeCacheContext::getCacheableMetadata()
  2. 10 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\NoOptimizeCacheContext::getCacheableMetadata()
  3. 11.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\NoOptimizeCacheContext::getCacheableMetadata()

Overrides CacheContextInterface::getCacheableMetadata

File

core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php, line 302

Class

NoOptimizeCacheContext
Non-optimizable context class.

Namespace

Drupal\Tests\Core\Cache\Context

Code

public function getCacheableMetadata() {
    $cacheable_metadata = new CacheableMetadata();
    return $cacheable_metadata->setCacheMaxAge(0);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.