Can we not cache banners that vary with basket contents?


LiteMage Standard on Magento 2.4.4 CE

Litespeed page cache works fine, but we would like to configure text/html banners that vary according to rules that might include for example basket contents etc.
We're using an Amasty extension to do that, but there are core features like Price Rules that use the same kind of configuration.

But the page cacheing is preventing these banner updates.

Is there anything we can do to change that?




Well-Known Member
Regardless of your individual needs, with LScache (LScache == LiteMage) it is possible to either exclude specific areas of a page's content from the cache or to define special cache rules for these areas. LScache uses ESI (Edge Side Includes), which could also be called a fragment cache. The functionality for your requirements would be there, but this ESI functionality for individual use is not available in LiteMage, so you unfortunately cannot use ESI with LiteMage. The only solution is to modify the Amasty extension so that the changing content is loaded via client side scripting. This modification would not only meet the requirements of LiteMage, but would also correspond to any other page cache, such as Varnish or Magento cache, because the problem arises with any other page cache. Amasty should therefore revise all extensions so that these extensions become cache friendly.

FYI: There are alternatives to LiteMage available.
Thank you very much for your reply - I did believe such exclusion rules existed and have been disappointed in the limited configurability of LiteMage.
Lots to look into there - thanks again.


Well-Known Member
It may sound paradoxical and even if ESI would be the solution for you, ESI also has disadvantages. ESI can become a performance killer because the areas or content fragments that are excluded from caching result in the cache performance being halved. It is therefore better to use a client side scripting solution, which Magento has been doing throughout the shop since version 2.46, so that no matter which page cache works without any problems.