Hey, need help with your Magento, WooCommerce or Laravel project? I have some availalility. Contact me.

Flush Magento Cache vs Flush Cache Storage

Magento, Quick Tip

This is question is asked and answered on Stack Overflow before, but it always surprises me how many people still don't know the difference. 

The difference is quite simply though:

  • Flush Magento Cache
    Deleted everything in the cache that is owned by Magento.

  • Flush Cache Storage
    Deletes everything in the cache storage, no matter if it's owned by Magento or not.

That is a little bit abstract. Let's explain this by example. Imagine you have an Magento 2 store that has it's cache configured to be saved in Redis. On the same server you have a Laravel application that also has it's cache configured to be saved in Redis. Normally you would set this up to have them both use different databases within Redis, but this is not always the case. Imagine that 60% of the cache items are created by Magento, and 40% of the items by Laravel.

Let see what happens if we do either of this action:

  • Flush Magento Cache
    This would flush 60% of the cache items. This number varies a little as Magento tries to deletes all known cache keys, but you might have a custom cache from a module that does not follow all rules.

  • Flush Cache Storage
    This will delete 100% of all keys in the cache, including the keys owned by Laravel. It doesn't make a distinction between the Laravel and Magento keys.

MageDispatch.com (ad)

Hey, I'm running a developer focussed newsletter called MageDispatch.com, which is for the community and by the community. Here you can share links that you think that the community should know about. If you like this kind of technical content you will like this newsletter too.

So when to choose which?

It's good to start to flush only the Magento cache, as it is the cleanest one. But if that doesn't solve your current issue, try the Flush Cache Storage variant as it is the most rigorous of the two. If your site is down and you need to find out why, slam this button to see if it helps.

Also, it depends a little on which cache driver you are using. If it is configured to use the database or the file system, there isn't much difference. If it is configured to use Redis, but Magento is the only consumer, then there is still little to none difference.

It all depends a little bit on your setup, but i think that in 99% of the cases there is little to none difference, that's why i'm most of the time defaulting to the Flush Cache Storage option. 

Want to respond?