1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-25 22:04:05 +00:00

httpcache: don't store already cached response.

This commit is contained in:
Rolando Espinoza La fuente 2011-12-30 14:21:07 -04:00
parent f2966eebc7
commit 503fdf39fe

View File

@ -52,7 +52,9 @@ class HttpCacheMiddleware(object):
raise IgnoreRequest("Ignored request not in cache: %s" % request)
def process_response(self, request, response, spider):
if self.is_cacheable(request) and self.is_cacheable_response(response):
if (self.is_cacheable(request)
and self.is_cacheable_response(response)
and 'cached' not in response.flags):
self.storage.store_response(spider, request, response)
stats.inc_value('httpcache/store', spider=spider)
return response