ShsTermCacheDependency.php in Simple hierarchical select 2.0.x
File
src/Cache/ShsTermCacheDependency.php
View source
<?php
namespace Drupal\shs\Cache;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
class ShsTermCacheDependency implements CacheableDependencyInterface {
public function __construct($tags = []) {
$this->contexts = [
'languages:language_interface',
];
$this->tags = Cache::mergeTags([
'taxonomy_term_values',
], $tags);
$this->maxAge = Cache::PERMANENT;
}
public function getCacheContexts() {
return $this->contexts;
}
public function getCacheTags() {
return Cache::mergeTags($this->tags, \Drupal::entityTypeManager()
->getDefinition('taxonomy_term')
->getListCacheTags());
}
public function getCacheMaxAge() {
return $this->maxAge;
}
}