How come the cache middlewares are commented out?
Hi
How come UpdateCacheMiddleware and FetchFromCacheMiddleware are commented out in settings.py?
Thanks!
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.
To enter a block of code:
Comments