![]() ![]() In a similar situation, I can add my block in a few versions to cache (preventing the same user watching the same order of products), but I don't know how to achieve that. Use Page Cache Killer Block when: The block is not private yet presenting such content. ![]() If at all even one such block is there on a page then the whole page is not cacheable for the full page cache. With a low cache lifetime most users will not see the same version twice: The block is a page cache killer in the event that the cacheable attribute is fixed to false in the layout declaration. To enable Varnish cache in Magento, login to the administrative panel and navigate to Stores > Configuration > Advanced > System. The following method in a block caches 10 versions of the block and rotates them for each user. If you want to avoid showing the same products to the same user on a page refresh, you can cache multiple versions of the block using different cache keys and select one of the tags based on time, a counter in the session, or randomly. Even with a cache lifetime of just a few minutes, this will reduce the load on a frequently visited page significantly. ![]() If I find out how to set TTL for block, a nice improvement would be one from here:įirst, make sure that you don’t load random products on every request. I am not sure how to test if it working - I set 15 seconds for my block, but actually order of product never changed. I can exclude it completly from caching using `cacheable="false", but that's not exactly I need. I would like to set cache lifetime for block in layout xml if possible. I have added custom sorting of products in catalog pages, by random order and I want my block to be dynamicall, so with every change of sorting for random the collection should be shuffled. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |