Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ba592950689a06893c77bc97040770f89dd5a317 1 parent e9f647e
Malcolm Tredinnick authored September 30, 2008

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  django/middleware/cache.py
5  django/middleware/cache.py
@@ -89,8 +89,9 @@ def process_response(self, request, response):
89 89
             # max-age was set to 0, don't bother caching.
90 90
             return response
91 91
         patch_response_headers(response, timeout)
92  
-        cache_key = learn_cache_key(request, response, timeout, self.key_prefix)
93  
-        cache.set(cache_key, response, timeout)
  92
+        if timeout:
  93
+            cache_key = learn_cache_key(request, response, timeout, self.key_prefix)
  94
+            cache.set(cache_key, response, timeout)
94 95
         return response
95 96
 
96 97
 class FetchFromCacheMiddleware(object):

0 notes on commit ba59295

Please sign in to comment.
Something went wrong with that request. Please try again.