Magento (How to fix): One or more of the Cache Types are invalidated: Blocks HTML output.

Magento (How to fix): One or more of the Cache Types are invalidated: Blocks HTML output.

Some time has passed since I wrote original version of this article, Magento was at 1.5. these days…

Now, almost 2 years later I have decided to revamp the article since lot’s of feedback is gathered…

For that purpose, I have wrote small extension for it that you can find here:

I would like to thank all of you, especially people that gave suggestions in order to improve it.

Main difference is that it is done through observer and the code is wrapped up in extension for easier use.

Keep in mind that this extension is created for purposes of blog article at and as such can only be used as proof of concept. If you find it helpful in order to learn Magento, that is great, but be careful if you plan to use it in production environment even though I do :)

Some sites can’t afford to clean block cache on every product edit, so please keep that in mind.

Thanks, and looking forward to your feedback!


Care to rate this post?


Tomas Novoselic

Team Leader, Backend Developer

At Inchoo, Tomas is a Team Leader and Certified Magento Developer who handles Magento modifications at any level. He also works closely with clients on Magento projects of any size and difficulty.

Other posts from this author

Discussion 78 Comments

1 2
Add Comment
  1. Ad

    Not really. Magento Cron runs on my server but the cache block still gets invalid. (
    Fix from travis worked fine. Thanks!

  2. anax

    works like anything thanks a lot

  3. Tomas Novoselic

    Hi everyone, I would just like to inform you that there is revamped version of this article if you are interested! ;)

  4. Alex

    Why dont you check at least if cache is invalidated before flushing it? Something like
    $invalidateTypes = Mage::app()->getCacheInstance()->getInvalidatedTypes();

    if (!empty($invalidateTypes['block_html'])) {…

  5. Tomas Novoselic

    @Alex I could have added it, however, it is ALWAYS invalidated, even if you save product with no NEW data, however I don’t see what can it break, so I will add it as soon as possible :) Thanks for feedback!

  6. Already created this little extension myself, a few differences, I made a yes/no enable feature for the backend, in yours you have singleton inside the observer where as mine does not.
    Why should this be needed?


  7. Tomas Novoselic

    Hi Robert,

    Well… you are right … singleton is not needed since if you don’t specify otherwise, you will always get singleton :)

  8. Thank you for sharing superb informations. Your website is very cool.
    I’m impressed by the details that you have on this web site. It reveals how nicely you

    understand this subject. Bookmarked this website page, will come back for extra articles.

    You, my pal, ROCK! I found just the information I already searched all over the place

    and simply could not come across. What an ideal website.

  9. Thanks for sharing such a good thought, piece of writing is pleasant, thats why i have read it entirely

  10. Fantastic goods from you, man. I have understand
    your stuff previous to and you’re just extremely excellent. I really like what you have acquired here, certainly like what you’re saying and the way in which you say it.
    You make it enjoyable and you still care for to keep it sensible.
    I can’t wait to read far more from you. This is really a terrific website.

  11. I’ve worte a Extension for this Issues.

    There just do the same, but i had add also a CronJob to check if one of the caches are invalid and clean this type.
    bacause the cache will be invalid, when u save Catalog Rules or each other settings:

  12. We are a gaggle of volunteers and starting a new scheme in our community.
    Your site provided us with helpful info to work on.
    You’ve done a formidable job and our whole community might be thankful to you.

  13. Casper

    I am pretty new with Magento. How do I even “install” this extension?

    Thanks so much in advance!

  14. @Casper – Just unpack it and copy to your site’s root directory…

  15. darren

    Tomas, is there any tutorial that I can follow to install this extension?

  16. Tomas Novoselic

    @darren You mean tutorial for copy-paste? Please check my previous comment: “@Casper – Just unpack it and copy to your site’s root directory…”

  17. Hi Tomas i tried to install your app but it gave me some problem, you write in the README file:
    ” ….It works only for US….. ”
    why only for US they look better than european or oceanian african etc… ? ;-)

  18. Tomas Novoselic

    @Fulvio … Hm… where exactly did you read that it works only for US?

    Maybe you read that one on this (OTHER) extension:

    Well, in that case I’m afraid you should try some other extension like this one:

    My version was created as part of the project on which client had no interest in shipping to any other country than USA so that save us some time and some cost to the client ;)

  19. Tomas Novoselic

    Hm… weird… that’s part of initial commit … I’m not sure how did you ended up there :)

    This is latest version in zip:

    Please try it by extracting it to your site root directory. It should work.

  20. Thanks Thomas it works great for Magento

  21. Brian Murphy

    Thank you – works like a charm in Magento

  22. Nice, but what if we use Full Page Cache on our site ? We often get the HTML invalidation – and all the time we need to refresh full cache, and run full page crawler for whole site. Can it be avoid ?

  23. Works fine on, but in Magento 1.8 the problem is back and your fix don’t work correct.

  24. Terrific work! That is the type of info that should be shared around the internet.
    Shame on Google for now not positioning this post upper!
    Come on

    over and consult with my website . Thank you


  25. Dave Wilson

    I’m seeing that the cache is refreshed properly, but for some reason the warning is still appearing, even with the content up to date. Is this happening for anyone else or is it just me?

  26. Any chance we can see an update for Annoyingly this issue still exists.

  27. B. Moore

    Any chance of getting your extension updated to work with Magento EE ver. ?

1 2

Add Your Comment

Please wrap all source codes with [code][/code] tags.