mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-24 20:47:54 +00:00
Add enable param to init
This commit is contained in:
@@ -29,7 +29,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":
|
||||
if (
|
||||
request and request.headers.get("Cache-Control") == "no-store"
|
||||
) or not FastAPICache.get_enable():
|
||||
return await func(*args, **kwargs)
|
||||
|
||||
coder = coder or FastAPICache.get_coder()
|
||||
|
||||
Reference in New Issue
Block a user