Question

I have page cache enabled and it is working fine.

In Magento 1.9 when I update anything on website then I have to flush full page cache (Amasty plugin) otherwise changes wont reflect on frontend.

Whereas, in Magento 2.2.5, I am using built-in Page cache, and every time I update anything on website, I don't need to flush cache, it is updating on frontend instantly.

Is there something wrong with the Page cache? Is it working or not?

Was it helpful?

Solution

There is nothing wrong with your page cache, actually it's a feature of Magento2 that whenever a product/category/cms is saved, then it invalidate particular cache tag then it will regenerate cache on page visit.

Each entity (Product/Category/CMS) has it's own cache tag, from which you can access that cache directly through tag, and you can also delete that cache tag.

It is not like that it is flushing whole magento cache, it is clearing the cache of that specific tag.

For more info, please see this: https://devdocs.magento.com/guides/v2.2/extension-dev-guide/cache/page-caching/public-content.html

Also this: Magento2: Product page changes are reflecting immediately even if FPC is enabled

Hope you will find what you are looking

OTHER TIPS

It is a default feature in Magento for managing public and private content, it automatically checks the state when any POST request is made and sends proper data after it validates all the cache to the respective hash in X-Magento-Vary cookie or using the customer sections.

You can read up on these concepts on devdocs here - https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/page-caching.html

In general whenever you're not sure whether cache is on or not or for any cache related debugging purpose Magento provides it's own cache debug header i.e X-Magento-Cache-Debug it will return a MISS when cache is not used to load the page and a HIT if it loaded from cache.

You can set indexers to 'Update by Schedule'. A cron job runs every X minutes and does reindex on the products/categories you've changed in admin. And only after that it flush cache for those entities by cache tags/identifiers. The bigger X minutes will be, the longer will stay in cache.

You can set the frequency of indexer cron jobs in Admin > Stores > Configuration > Advanced > System > Cron (Schedule Task) > Cron configuration for group index > Generate Schedules Every = X. And set the other configurations there accordingly.

More about MView and some info about cache clean here: what is mview in magento2?

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top