diff --git a/CHANGELOG.md b/CHANGELOG.md index f52d7f8..53fcfc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## 0.2 +### 0.2.1 +- Fix picklecoder +- Fix connection failure transparency +- Add Cache-Control and ETag on first response + ### 0.2.0 - Make `request` and `response` optional. diff --git a/fastapi_cache/decorator.py b/fastapi_cache/decorator.py index f08a39e..57f6a9d 100644 --- a/fastapi_cache/decorator.py +++ b/fastapi_cache/decorator.py @@ -125,7 +125,7 @@ def cache( ) try: ttl, ret = await backend.get_with_ttl(cache_key) - except ConnectionError: + except Exception: ttl, ret = 0, None if not request: if ret is not None: @@ -133,7 +133,7 @@ def cache( ret = await ensure_async_func(*args, **kwargs) try: await backend.set(cache_key, coder.encode(ret), expire) - except ConnectionError: + except Exception: pass return ret @@ -156,7 +156,7 @@ def cache( try: await backend.set(cache_key, encoded_ret, expire) - except ConnectionError: + except Exception: pass response.headers["Cache-Control"] = f"max-age={expire}"