diff --git a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php index 894ecb0efd..572c9ee55e 100644 --- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php @@ -236,10 +236,14 @@ public function generateResultsKey() { public function getCacheTags() { $tags = $this->view->storage->getCacheTags(); $filter_tags = []; - // Bundle filters could provide optimized cache tags. foreach ($this->view->filter as $filter) { if ($filter instanceof Bundle && $filter->value) { - $filter_tags[$filter->getEntityType()] = array_keys($filter->value); + // Bundle filters could provide optimized cache tags when limit query to + // specific list. + $entity_type_id = $filter->getEntityType(); + $filter_tags[$entity_type_id] = array_map(function ($bundle) use ($entity_type_id) { + return $entity_type_id . '_list:' . $bundle; + }, $filter->value); } } @@ -251,7 +255,8 @@ public function getCacheTags() { // Add the list cache tags for each entity type used by this view. foreach ($entity_information as $table => $metadata) { if (isset($filter_tags[$metadata['entity_type']])) { - // If the view use the bundle filter, add bundle specific cache tags. + // If the views display using a limited set of bundles in filter for + // the table, add optimized cache tags. $tags = Cache::mergeTags($tags, $filter_tags[$metadata['entity_type']]); } else {