function RefinableCacheableDependencyTrait::addCacheableDependency
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php \Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheableDependency()
- 10 core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php \Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheableDependency()
- 8.9.x core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php \Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheableDependency()
File
-
core/
lib/ Drupal/ Core/ Cache/ RefinableCacheableDependencyTrait.php, line 15
Class
- RefinableCacheableDependencyTrait
- Trait for \Drupal\Core\Cache\RefinableCacheableDependencyInterface.
Namespace
Drupal\Core\CacheCode
public function addCacheableDependency($other_object) {
if ($other_object instanceof CacheableDependencyInterface) {
$this->addCacheContexts($other_object->getCacheContexts());
$this->addCacheTags($other_object->getCacheTags());
$this->mergeCacheMaxAge($other_object->getCacheMaxAge());
}
else {
// Not a cacheable dependency, this can not be cached.
$this->cacheMaxAge = 0;
}
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.