I need some help to understanding Magento cache So Idea is that I want to refresh cache of specific category page (not all category pages) on an interval. How can i do that in Magento 2?
1 Answer
Something like below can help.
$categoryId = 'you-cat-id'; $category = $objectManager->create(\Magento\Catalog\Model\Category::class)->load($categoryId); $category->setIsChanged(true); $category->save(); This forces Magento to consider the category as changed and triggers the necessary cache refresh for it. I haven't tried it. But you can check though.
And of-course do not use object-manager directly.