You are here

public function NoOptimizeCacheContext::getCacheableMetadata in Drupal 10

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

File

core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php, line 330
Contains \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest.

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);
}