Don’t rely on caching

Oct 06 2011

Extracted from Django docs: “memory isn’t intended for permanent data storage, so don’t rely on memory-based caching as your only data storage. Without a doubt, none of the Django caching backends should be used for permanent storage”.

Here is the lesson: don’t rely on caching. Cache doesn’t exist to make applications work, it exists to make them faster and/or more scalable. Use a cache system as permanent storage is such a bad idea, except when you’re not using it for caching (what is not the case here). Cache is a shortcut for a path that might be painful to follow, but you still should not rely on cache. You must be able to traverse the path without the cache.

4 responses so far

  1. thanks Captain Obvious.

  2. Please tell it is obvious to people who act like it was not.

  3. Contra Marcus: if you, Francisco, or someone you are trying to help needed this advice, then it was a fine thing to write a short blog entry about. When I give talks each month at Python Atlanta, I continue to be surprised about how often people benefit from the simple hints in my talks, and not from the big technical point I am trying to make. Many, many people using Python these days have no formal background in programming, and need those of us with more formal computing training to keep repeating the basics of how applications and programs fit together.

  4. Very good advice, often needed by some ppl who thinks Memcache is a database :P

Leave a Reply

Spam protection by WP Captcha-Free