diff --git a/core/lib/Drupal/Core/Cache/MutableCacheableDependencyInterface.php b/core/lib/Drupal/Core/Cache/MutableCacheableDependencyInterface.php index 6434dc1..acfe5f6 100644 --- a/core/lib/Drupal/Core/Cache/MutableCacheableDependencyInterface.php +++ b/core/lib/Drupal/Core/Cache/MutableCacheableDependencyInterface.php @@ -37,16 +37,15 @@ public function addCacheContexts(array $cache_contexts); public function addCacheTags(array $cache_tags); /** - * Adds the maximum age (in seconds). + * Sets the maximum age (in seconds). + * + * This only sets the max age if it is lower than the existing one. * * @param int $max_age * The max age to associate. * * @return $this - * - * @throws \InvalidArgumentException - * If a non-integer value is supplied. */ - public function addCacheMaxAge($max_age); + public function setCacheMaxAgeIfLower($max_age); } diff --git a/core/lib/Drupal/Core/Cache/MutableCacheableDependencyTrait.php b/core/lib/Drupal/Core/Cache/MutableCacheableDependencyTrait.php index 042c7c9..8d33b55 100644 --- a/core/lib/Drupal/Core/Cache/MutableCacheableDependencyTrait.php +++ b/core/lib/Drupal/Core/Cache/MutableCacheableDependencyTrait.php @@ -52,7 +52,7 @@ public function addCacheTags(array $cache_tags) { /** * {@inheritdoc} */ - public function addCacheMaxAge($max_age) { + public function setCacheMaxAgeIfLower($max_age) { $this->cacheMaxAge = Cache::mergeMaxAges($this->cacheMaxAge, $max_age); return $this; } diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index 2e1a208..2d443d1 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -353,15 +353,13 @@ public function getOriginalId(); * Returns the cache tags that should be used when invalidating caches. * * This will not return additional cache tags added through addCacheTags(). - * Invalidating caches that are depending on this entity must use this - * method. + * Invalidating caches that are depending on this entity must use this method. * * @return string[] * Set of cache tags. * * @see \Drupal\Core\Cache\MutableCacheableDependencyInterface::addCacheTags() * @see \Drupal\Core\Cache\CacheableDependencyInterface::getCacheTags() - * */ public function getCacheTagsForInvalidation(); diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 32b86a6..b7d3aa5 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -1346,8 +1346,8 @@ public function addCacheContexts(array $cache_contexts) { /** * {@inheritdoc} */ - public function addCacheMaxAge($max_age) { - return $this->storage->addCacheMaxAge($max_age); + public function setCacheMaxAgeIfLower($max_age) { + return $this->storage->setCacheMaxAgeIfLower($max_age); } /**