Domanda

I need suggestion. I do not have an Idea to set cache for specific page url. For example I have an Url : http://127.0.0.1/magento234/women/tops-women/jackets-women.html

How can I set full page cache for above page programmtically ? I do not have any idea how to do it and which observer which classes should be used for that ? If someone post a code to set cache for specific url ,it would be great help.

Thank you

È stato utile?

Soluzione

Full page cache in Magento 2 works with Varnish (https://devdocs.magento.com/guides/v2.4/config-guide/varnish/config-varnish.html)

You do not need to cache urls programmatically, it will happen as soon as you hit the caching proxy (assuming you configured Magento to use Varnish).

If you want to create the cache before a user hits the page, you could visit the page manually, or write a crawler that loads the page and therefore stores it into cache.

use command

curl -s -o /dev/null  http://127.0.0.1/magento234/women/tops-women/jackets-women.html 
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top