trait UncacheableDependencyTrait

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php \Drupal\Core\Cache\UncacheableDependencyTrait
  2. 10 core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php \Drupal\Core\Cache\UncacheableDependencyTrait
  3. 11.x 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


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