You are here

public function ProductVariation::getCacheTagsToInvalidate in Commerce Core 8.2

Returns the cache tags that should be used to invalidate caches.

This will not return additional cache tags added through addCacheTags().

Return value

string[] Set of cache tags.

Overrides EntityBase::getCacheTagsToInvalidate

See also

\Drupal\Core\Cache\RefinableCacheableDependencyInterface::addCacheTags()

\Drupal\Core\Cache\CacheableDependencyInterface::getCacheTags()

File

modules/product/src/Entity/ProductVariation.php, line 358

Class

ProductVariation
Defines the product variation entity class.

Namespace

Drupal\commerce_product\Entity

Code

public function getCacheTagsToInvalidate() {
  $tags = parent::getCacheTagsToInvalidate();

  // Invalidate the variations view builder and product caches.
  return Cache::mergeTags($tags, [
    'commerce_product:' . $this
      ->getProductId(),
    'commerce_product_variation_view',
  ]);
}