Add middleware support for the 'no-store' Cache-Control directive.

This commit is contained in:
Pedro Faustino 2012-12-24 13:27:13 +01:00
parent bb55f39aed
commit 0e435fb5f9
1 changed files with 8 additions and 3 deletions

View File

@ -83,11 +83,16 @@ class HttpCacheMiddleware(object):
return response
def is_cacheable_response(self, response):
return response.status not in self.ignore_http_codes
retval = response.status not in self.ignore_http_codes
if not self.use_dummy_cache and response.headers.has_key('cache-control'):
retval = retval and (response.headers['cache-control'].lower().find('no-store') == -1)
return retval
def is_cacheable(self, request):
return urlparse_cached(request).scheme not in self.ignore_schemes
retval = urlparse_cached(request).scheme not in self.ignore_schemes
if not self.use_dummy_cache and request.headers.has_key('cache-control'):
retval = retval and (request.headers['cache-control'].lower().find('no-store') == -1)
return retval
class FilesystemCacheStorage(object):