trait UncacheableDependencyTrait
Trait to implement CacheableDependencyInterface for uncacheable objects.
Use this for objects that are never cacheable.
Hierarchy
- trait \Drupal\Core\Cache\UncacheableDependencyTrait
 
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\CacheView source
trait UncacheableDependencyTrait {
  
  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return [];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    return [];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return 0;
  }
}
Members
| Title Sort descending | Modifiers | Object type | Summary | 
|---|---|---|---|
| UncacheableDependencyTrait::getCacheContexts | public | function | |
| UncacheableDependencyTrait::getCacheMaxAge | public | function | |
| UncacheableDependencyTrait::getCacheTags | public | function | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.