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
This commit is contained in:
parent
e9f647e11f
commit
ba59295068
|
@ -89,6 +89,7 @@ class UpdateCacheMiddleware(object):
|
||||||
# max-age was set to 0, don't bother caching.
|
# max-age was set to 0, don't bother caching.
|
||||||
return response
|
return response
|
||||||
patch_response_headers(response, timeout)
|
patch_response_headers(response, timeout)
|
||||||
|
if timeout:
|
||||||
cache_key = learn_cache_key(request, response, timeout, self.key_prefix)
|
cache_key = learn_cache_key(request, response, timeout, self.key_prefix)
|
||||||
cache.set(cache_key, response, timeout)
|
cache.set(cache_key, response, timeout)
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in New Issue