Merge pull request #33 from DevLucca/master

add `no-cache` to cache exclusion
This commit is contained in:
long2ice
2022-10-31 21:51:35 +08:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -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)