UnchangingCacheableDependencyTrait.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/Cache/UnchangingCacheableDependencyTrait.php
  2. 10 core/lib/Drupal/Core/Cache/UnchangingCacheableDependencyTrait.php
  3. 11.x core/lib/Drupal/Core/Cache/UnchangingCacheableDependencyTrait.php

Namespace

Drupal\Core\Cache

File

core/lib/Drupal/Core/Cache/UnchangingCacheableDependencyTrait.php

View source
<?php

namespace Drupal\Core\Cache;


/**
 * Trait to implement CacheableDependencyInterface for unchanging objects.
 *
 * @see \Drupal\Core\Cache\CacheableDependencyInterface
 */
trait UnchangingCacheableDependencyTrait {
    
    /**
     * {@inheritdoc}
     */
    public function getCacheContexts() {
        return [];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getCacheTags() {
        return [];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getCacheMaxAge() {
        return Cache::PERMANENT;
    }

}

Traits

Title Deprecated Summary
UnchangingCacheableDependencyTrait Trait to implement CacheableDependencyInterface for unchanging objects.

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