mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-26 08:03:54 +00:00
httpcache: don't store already cached response.
This commit is contained in:
parent
f2966eebc7
commit
503fdf39fe
@ -52,7 +52,9 @@ class HttpCacheMiddleware(object):
|
|||||||
raise IgnoreRequest("Ignored request not in cache: %s" % request)
|
raise IgnoreRequest("Ignored request not in cache: %s" % request)
|
||||||
|
|
||||||
def process_response(self, request, response, spider):
|
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)
|
self.storage.store_response(spider, request, response)
|
||||||
stats.inc_value('httpcache/store', spider=spider)
|
stats.inc_value('httpcache/store', spider=spider)
|
||||||
return response
|
return response
|
||||||
|
Loading…
x
Reference in New Issue
Block a user