Flush Cache Storage: When to Use It
Sometimes strange problems and behaviors appear after deploying a Magento store. Learn how a simple cache flush can solve everything when nothing else works.
Cache flush to the rescue
The task was to install a new extension. Developers installed it on a local / staging environment. Everything was fine, so the client accepted deploy to live.
And strange things started to happen..
After deployment, new section in System -> Configuration appeared (as it should), migrations had been run and new admin menu items were added. But clicking on those new menu links led to empty pages. Admin header and footer was rendered, but page body content was empty. Error logs remained untouched.
After a brief debugging it was clear that Magento was ignoring layout update .xml file. We tried to clean configuration, block, layout and even Magento cache, but without success. So here we go again with even deeper debugging, inserting trace messages into Magento core files, digging into layout composing/rendering logic.
TLDR;- it was cache that was not cleared. Live site used “2-back-end cache” cache driver, which includes 2 simple drivers — in this case Redis was used for fast cache and File for slow cache. This means, that Magento first checks Redis for cache key, then file cache, then generates content. The drawback of this approach is that tags aren’t working as they do with “1-back-end” cache.
We had to push Flush Cache Storage button, which flushes both Redis and File cache — so Magento generated updated version of admin layouts and desired pages rendered as expected.
Things to consider about cache flushing:
sometimes cleaning cache by tags will not work;
sometimes clearing var/cache folder is not enough;
sometimes flushing whole cache storage is the only option;
- some [high load] projects don’t allow to flush cache during the daytime. Please make sure your project is not among those before trying to flush cache at live!
Author: Alex Rehov, Senior Developer in SW.
Need help from Superheroes?
Things breaking apart? Need assistance in Magento maintenance? You can light up the Bat Signal through the contact form here: www.scandiweb.com/contact or by leaving direct message to us via email@example.com