You are here

class ShsTermCacheDependency in Simple hierarchical select 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/ShsTermCacheDependency.php \Drupal\shs\Cache\ShsTermCacheDependency

Cacheable dependency object for term data.

Hierarchy

Expanded class hierarchy of ShsTermCacheDependency

1 file declares its use of ShsTermCacheDependency
ShsController.php in src/Controller/ShsController.php

File

src/Cache/ShsTermCacheDependency.php, line 11

Namespace

Drupal\shs\Cache
View source
class ShsTermCacheDependency implements CacheableDependencyInterface {

  /**
   * {@inheritdoc}
   */
  public function __construct($tags = []) {
    $this->contexts = [
      'languages:language_interface',
    ];
    $this->tags = Cache::mergeTags([
      'taxonomy_term_values',
    ], $tags);
    $this->maxAge = Cache::PERMANENT;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return $this->contexts;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    return Cache::mergeTags($this->tags, \Drupal::entityTypeManager()
      ->getDefinition('taxonomy_term')
      ->getListCacheTags());
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return $this->maxAge;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ShsTermCacheDependency::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts
ShsTermCacheDependency::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge
ShsTermCacheDependency::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags
ShsTermCacheDependency::__construct public function