mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 05:33:37 +00:00
CacheHandler checks cached response to be OK before returning to requests HTTP handler now.
This commit is contained in:
parent
d0ac2936b0
commit
437b46f907
1 changed files with 6 additions and 4 deletions
|
@ -151,9 +151,11 @@ class CacheController(object):
|
||||||
fresh = (freshness_lifetime > current_age)
|
fresh = (freshness_lifetime > current_age)
|
||||||
|
|
||||||
if fresh:
|
if fresh:
|
||||||
|
if resp.ok:
|
||||||
# make sure we set the from_cache to true
|
# make sure we set the from_cache to true
|
||||||
resp.from_cache = True
|
resp.from_cache = True
|
||||||
return resp
|
return resp
|
||||||
|
return False
|
||||||
|
|
||||||
# we're not fresh. If we don't have an Etag, clear it out
|
# we're not fresh. If we don't have an Etag, clear it out
|
||||||
if 'etag' not in resp.headers:
|
if 'etag' not in resp.headers:
|
||||||
|
@ -216,7 +218,7 @@ class CacheController(object):
|
||||||
|
|
||||||
# If the request is for our local cache, it means we should cache it
|
# If the request is for our local cache, it means we should cache it
|
||||||
elif self.cache_force:
|
elif self.cache_force:
|
||||||
resp.headers.update({'cache-control': 'max-age=21600, private'})
|
resp.headers.update({'cache-control': 'max-age=900, private'})
|
||||||
self.cache.set(cache_url, resp)
|
self.cache.set(cache_url, resp)
|
||||||
|
|
||||||
def update_cached_response(self, request, response):
|
def update_cached_response(self, request, response):
|
||||||
|
|
Loading…
Reference in a new issue