[patch] add anonymous-only caching to CacheMiddleware
|Reported by:||matt||Owned by:||jacob|
|Component:||Core (Cache system)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Here is a patch against trunk's django.middleware.cache.CacheMiddleware to optionally only cache anonymously requested (non-logged-in user) pages. Since rendered pages may contain user-specific information if they are logged in, caching those site-wide is often a bad idea. With this mdified middleware and CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True in your settings file, django can cache your non-logged in pages while serving up non-cached pages to logged in users.
I'm not a huge fan of CACHE_MIDDLEWARE_ANONYMOUS_ONLY so if someone thinks of a better name for it, feel free.