I have developed a custom module the retrieve data from database and displayed in a block. The data is updated in database but the page is not showing the latest data if cached is enabled. If the cache is disabled, everything just works fine. Sometimes, even cannot get the customer ID from session if cache is enabled. How to resolve this issue?


Cacheable false should be avoid. It set complete as a non-cache if added false in layout


I finally find out that if we need to get current customer session in a block, cacheable must be set to false in the layout xml.


Magento used cacheable="false" in OOTB layout.

If page is independent then recommend to use cacheable="false". Also avoid to add cacheable="false" in default.xml layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.