For example how to check if "Blocks HTML output" is enabled, strangely I have trouble to find out that information.

I'd like to know that in order to add conditions before saving and loading custom cached content which is parts of the HTML block output and is programmed in the template file because in the inner HTML I had to output dynamic data a couple times, so I am doing custom "hole punching" and the block class is not caching the whole template.

1 Answer 1


Thats how you get all Cache types with the status


If you take a look in Mage_Core_Model_Cache you can see the Method canUse() The Description of the Method is:

Check if cache can be used for specific data type

I think it's exactly what you need and the return is true or false. You can call it like this:

  • 1
    Thanks! I was looking exact at that code before asking, not sure why I decided it is something else. I would just add that instead of using hard-coded block type ID, I use $this::CACHE_GROUP, where $this is in a template file of a block. So the code becomes: Mage::app()->getCacheInstance()->canUse($this::CACHE_GROUP)
    – kanevbgbe
    Aug 26, 2016 at 9:18

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.