core-bundle/src/Resources/contao/classes/DataContainer.php
protected function invalidateCacheTags(self $dc)
	{
		if (!System::getContainer()->has('fos_http_cache.cache_manager'))
		{
			return;
		}

		$ns = 'contao.db.';
		$tags = array($ns . $dc->table, $ns . $dc->table . '.' . $dc->id);

		if ($dc->ptable && $dc->activeRecord && $dc->activeRecord->pid > 0)
		{
			$tags[] = $ns . $dc->ptable;
			$tags[] = $ns . $dc->ptable . '.' . $dc->activeRecord->pid;
		}

		// Trigger the oninvalidate_cache_tags_callback
		if (\is_array($GLOBALS['TL_DCA'][$dc->table]['config']['oninvalidate_cache_tags_callback']))
		{
			foreach ($GLOBALS['TL_DCA'][$dc->table]['config']['oninvalidate_cache_tags_callback'] as $callback)
			{
				if (\is_array($callback))
				{
					$this->import($callback[0]);
					$tags = $this->{$callback[0]}->{$callback[1]}($dc, $tags);
				}
				elseif (\is_callable($callback))
				{
					$tags = $callback($dc, $tags);
				}
			}
		}

		// Make sure tags are unique and empty ones are removed
		$tags = array_filter(array_unique($tags));

		/** @var CacheManager $cacheManager */
		$cacheManager = System::getContainer()->get('fos_http_cache.cache_manager');
		$cacheManager->invalidateTags($tags);
	}
protected function invalidateCacheTags(self $dc)
	{
		if (!System::getContainer()->has('fos_http_cache.cache_manager'))
		{
			return;
		}

		$ns = 'contao.db.';
		$tags = array($ns . $dc->table, $ns . $dc->table . '.' . $dc->id);

		if ($dc->ptable && $dc->activeRecord && $dc->activeRecord->pid > 0)
		{
			$tags[] = $ns . $dc->ptable;
			$tags[] = $ns . $dc->ptable . '.' . $dc->activeRecord->pid;
		}

		// Trigger the oninvalidate_cache_tags_callback
		if (\is_array($GLOBALS['TL_DCA'][$dc->table]['config']['oninvalidate_cache_tags_callback']))
		{
			foreach ($GLOBALS['TL_DCA'][$dc->table]['config']['oninvalidate_cache_tags_callback'] as $callback)
			{
				if (\is_array($callback))
				{
					$this->import($callback[0]);
					$tags = $this->{$callback[0]}->{$callback[1]}($dc, $tags);
				}
				elseif (\is_callable($callback))
				{
					$tags = $callback($dc, $tags);
				}
			}
		}

		// Make sure tags are unique and empty ones are removed
		$tags = array_filter(array_unique($tags));

		/** @var CacheManager $cacheManager */
		$cacheManager = System::getContainer()->get('fos_http_cache.cache_manager');
		$cacheManager->invalidateTags($tags);
	}
Invalidate the cache tags associated with a given DC

Call this whenever an entry is modified (added, updated, deleted).

@param DataContainer $dc