Like I mentioned in my question I am having a problem with cleaning/flushing cache on category/product pages.
I get some code, probably for some older version of Magento but didn't work.
Here it is:
$cacheTag = \Magento\Catalog\Model\Category::CACHE_TAG . '_' . $catId;
$category = $this->categoryRepository->get($catId, $this->storeManager->getStore()->getId());
$this->cacheManager->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, [$cacheTag]);
$this->eventManager->dispatch('clean_cache_by_tags', ['object' => $category]);
The same example I found here:
https://magecomp.com/blog/clear-cache-for-specific-cms-page-programmatically-in-magento-2/
I check Manager class and method clean have only one parameter(argument) and this is an array of types. So I tried with one argument and I get one error: Notice: Undefined index: instance in /app/vendor/magento/framework/App/Cache/TypeList.php online 75
So is there any other way how to clean cache on the category or product page?
Tnx for the help.