/** * Get cache tags associated with object id * * @return string[] */ public function getCacheIdTags() { $tags = parent::getCacheIdTags(); $affectedCategoryIds = $this->getAffectedCategoryIds(); if (!$affectedCategoryIds) { $affectedCategoryIds = $this->getCategoryIds(); } foreach ($affectedCategoryIds as $categoryId) { $tags[] = \Magento\Catalog\Model\Category::CACHE_TAG . '_' . $categoryId; } return $tags; }