When the memcached fails on a server, Magento croaks and tells you the cache is bust 🙂

This means that if PHP can’t retrieve a cache key from the cache (since it does not run or is broken), PHP throws an error. Magento handles this by simply aplying the general error display. Not pretty!

Fortunately there is a sane fallback for Magento memcached backend, (Magento 1.3, 1.4 and 1.5).

For Magento 1.3 and 1.4, it is easily fixed with the following code:

This patch applies to Magento 1.5

As you can see in the code, this makes sure the configured cache works.

  1. Test the cache by retrieving a random key.
  2. If PHP throws an error, catch it with a try and catch block.
  3. Reset Magento to use the relatively safe file cache backend.

Done!

No more ugly cache-is-down errors 🙂

Scan je eigen Magento shop op veiligheidslekken