add no-cache to cache exclusion

This commit is contained in:
Lucca Leme Marques
2021-08-23 11:51:28 -03:00
parent 46c7ada364
commit dacd7e1b0f

View File

@@ -29,7 +29,7 @@ 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":
if request and request.headers.get("Cache-Control") in ("no-store", "no-cache"):
return await func(*args, **kwargs)
coder = coder or FastAPICache.get_coder()