I have developed an extension in magento 2.2.6. Now i am upgrade this in magento 2.3.1 but I am facing 1 issue.

In my phtml file $block->method() is called 1 time after cache:clean.

When I refresh the page second time then $block->method() execution does not reach in method body. I have done testing by writing die(); in method body and also return preview loaded data.

And now I am write cacheable="false" for block in layout file, then it works like 2.2.6. i.e on every refresh $block->method() read execution in method body.

I don't understand why need cache:clean on every refresh if don't use cacheable="false" .

And what is the best practice for this? May I use cacheable="false" or section.xml?

1 Answer 1


cacheable="false" means you have made your block cache lifetime 0 means the cache is not generated for that Block. That is very bad for site speed Up.

Most importance disadvantage of cacheable="false" is that If you make any block of a page cacheable="false" that means that Page fully Non-cachable

See that Magento Main architect Anton Kril post https://magento.stackexchange.com/a/134444/4564

That why Magento Custom account pages/Checkout/Cart Page is not cacheable.

Where, section.xml is a different concept using this private content of specific to individual users, it’s reasonable to handle it on the client (i.e., web browser).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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