diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf54bd..76a553a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ ## 0.1 +### 0.1.10 + +- Add `Cache-Control:no-cache` support. + ### 0.1.9 - Replace `aioredis` with `redis-py`. diff --git a/fastapi_cache/decorator.py b/fastapi_cache/decorator.py index be50d30..8521ad8 100644 --- a/fastapi_cache/decorator.py +++ b/fastapi_cache/decorator.py @@ -96,8 +96,9 @@ def cache( copy_kwargs = kwargs.copy() request = copy_kwargs.pop("request", None) response = copy_kwargs.pop("response", None) + if ( - request and request.headers.get("Cache-Control") == "no-store" + request and request.headers.get("Cache-Control") in ("no-store", "no-cache") ) or not FastAPICache.get_enable(): return await ensure_async_func(*args, **kwargs)