Author: mtredinnick
Date: 2008-09-29 22:58:09 -0500 (Mon, 29 Sep 2008)
New Revision: 9098
Modified:
django/trunk/django/middleware/cache.py
Log:
Fixed #9221 -- Small optimisation to caching middleware handling.
In the slightly unusual case that CACHE_MIDDLEWARE_SECONDS is set to 0, don't
bother storing a copy in the local cache.
Modified: django/trunk/django/middleware/cache.py
===================================================================
--- django/trunk/django/middleware/cache.py 2008-09-29 20:22:32 UTC (rev
9097)
+++ django/trunk/django/middleware/cache.py 2008-09-30 03:58:09 UTC (rev
9098)
@@ -89,8 +89,9 @@
# max-age was set to 0, don't bother caching.
return response
patch_response_headers(response, timeout)
- cache_key = learn_cache_key(request, response, timeout,
self.key_prefix)
- cache.set(cache_key, response, timeout)
+ if timeout:
+ cache_key = learn_cache_key(request, response, timeout,
self.key_prefix)
+ cache.set(cache_key, response, timeout)
return response
class FetchFromCacheMiddleware(object):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---