How to make cache for specific url by programmatically?
-
14-04-2021 - |
Вопрос
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
Решение
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