Question

It seems that by default Magento does not cache the majority of blocks.
I'm comfortable extending blocks and applying my own cache settings, but it seems odd that I would have to do this for the majority of everything.
Am I missing something or does it really take this much customization to really get the benefits of block level caching in Magento?

Was it helpful?

Solution

Magento is a flexible system and so the core developers assumed that most blocks can change dynamically. When you figure out that in your specific use case (your specific shop) some blocks are more or less static, the easiest way to cache them for a while would be to overwrite the cache lifetime using a local.xml file that you have place in your theme and the following snippet:

<reference name="name.of.the.block">
     <action method="setCacheLifetime"><seconds>86400</seconds></action>
</reference>

OTHER TIPS

Seems like they went with the safest bet and not cache the majority of the blocks. The core team doesn't know what the end content of a block will be and how dynamic it is. Additionally, you could end up filling up your cache storage with all the variants of each block (e.g. number of products * websites * store views).

If you find yourself caching the majority of your blocks you may be better off with a full page cache solution such as Varnish or Akamai's Site Accelerator.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top