You are here

trait UncacheableDependencyTrait in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php \Drupal\Core\Cache\UncacheableDependencyTrait

Trait to implement CacheableDependencyInterface for uncacheable objects.

Use this for objects that are never cacheable.

Hierarchy

See also

\Drupal\Core\Cache\CacheableDependencyInterface

3 files declare their use of UncacheableDependencyTrait
CacheableTestDomainObject.php in core/modules/system/tests/modules/early_rendering_controller_test/src/CacheableTestDomainObject.php
HistoryUserTimestamp.php in core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php
Random.php in core/modules/views/src/Plugin/views/sort/Random.php

File

core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php, line 12

Namespace

Drupal\Core\Cache
View source
trait UncacheableDependencyTrait {

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return 0;
  }

}

Members