First time here? Check out the FAQ!

How come the cache middlewares are commented out?

  • retag add tags


How come UpdateCacheMiddleware and FetchFromCacheMiddleware are commented out in


kate_r's avatar
asked 2013-06-08 12:47:14 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


The reason for that is that CacheMiddleware will indiscriminately cache everything and make the site useless - for example - you won't see any updates until the cached version expires or will not see them on time.

You might experiment with caching only anonymous requests with the middleware but personally I don't like showing stale data, especially on small sites (the absolute majority of sites) where caching is almost irrelevant.

IMO, many beginner site admins assume strange ideas about "scaling" and caching. If you look at your visitor log and find that you have less than a few visits per minute - I recommend to forget about caching as long as pages are served under 1s and generated in a couple of hundred milliseconds, because solving caching invalidation correctly is not easy.

Many "large sites" (e.g. those deployed by large companies) are actually small. Instead of making assumptions - look at the actual metrics.

Once you start getting close to a dozen visits per minute - start working improving the caching. Above one visit per second proper caching is a must have.

Askbot does some caching - for example rendered fragments on the main page are cached and invalidated when necessary, b/c that page is full of detail and caching makes noticeable difference.

Evgeny's avatar
answered 2013-06-08 13:13:27 -0500, updated 2013-06-08 13:19:58 -0500
edit flag offensive 0 remove flag delete link


add a comment see more comments