By best practice collections are typically instantiated in a Block. Best practice also dictates that a Block should set a cache tag and lifetime to take advantage of the Block caching mechanism.

This practice may render the use of a collection cache somewhat useless, at least as far as front-end performance is concerned. However the Collection Cache in Magento is ONLY utilized in TWO areas: neither are guarded by a Block cache: the Website collection (from within Mage::app()) and the Mage_Sales_Model_Resource_Order_Item collection.

This much makes sense. Lots of load on these collections from various places within Magento - it makes sense to implement the cache.

So, my question is: does it ever make sense for me to implement a collection cache if the only place it is used is inside of a Block, and that block does not have wide reuse across the front-end? Any rationale as to best practice here would be welcome.

Typed from my phone, apologies for typos

  • What about hole-punched blocks with EE FPC? Jul 20, 2014 at 0:15
  • Yeah, Allan, what about them? :)
    – philwinkle
    Jul 20, 2014 at 3:58

1 Answer 1


One scenario I can think of where you might want to cache the collection is if other content within the block is likely to change or you're working with multiple collection models.

For instance: Say you need to list the catalog's categories but mark ones where the customer has purchased something within those categories.

The list of categories will be same for all customers but the output would be different for each customer.

In this case it would make sense to cache the collection but not the block.

Another example: If you were to list categories and had a custom blog post model which are associated to a category. In this case you may want to cache the category collection since it doesn't change much but not the related blog collections as they'll be more likely to change. You can still cache the block for a set amount of time (e.g. a few hours) but cache the collection for a longer period of time (a few days).

I would imagine these types of cases are not very common tho.

  • I really like this rationale. It's a shame it isn't used more often because it could possibly help larger custom builds with sprawling catalogs. Unlike the Block Cache the Collection Cache never expires so it has at least a small benefit for those loads that happen to have expired the block cache.
    – philwinkle
    Jul 21, 2014 at 3:42

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.