mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-24 20:47:54 +00:00
Merge pull request #33 from DevLucca/master
add `no-cache` to cache exclusion
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
|
||||
## 0.1
|
||||
|
||||
### 0.1.10
|
||||
|
||||
- Add `Cache-Control:no-cache` support.
|
||||
|
||||
### 0.1.9
|
||||
|
||||
- Replace `aioredis` with `redis-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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user