You are here

class NoOptimizeCacheContext 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
  2. 9 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 311
Contains \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest.

Namespace

Drupal\Tests\Core\Cache\Context
View 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