This commit is contained in:
long2ice
2021-01-06 19:57:16 +08:00
parent 6f5d4900a9
commit 361a25857b
3 changed files with 6 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ check: deps
test: deps test: deps
$(py_warn) pytest $(py_warn) pytest
build: deps build: clean deps
@poetry build @poetry build
clean: clean:

View File

@@ -34,7 +34,10 @@ def cache(
expire = expire or FastAPICache.get_expire() expire = expire or FastAPICache.get_expire()
key_builder = key_builder or FastAPICache.get_key_builder() key_builder = key_builder or FastAPICache.get_key_builder()
backend = FastAPICache.get_backend() backend = FastAPICache.get_backend()
cache_key = key_builder(func, namespace, args=args, kwargs=kwargs) copy_kwargs = kwargs.copy()
copy_kwargs.pop("request", None)
copy_kwargs.pop("response", None)
cache_key = key_builder(func, namespace, args=args, kwargs=copy_kwargs)
ttl, ret = await backend.get_with_ttl(cache_key) ttl, ret = await backend.get_with_ttl(cache_key)
if not request: if not request:
if ret is not None: if ret is not None:

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "fastapi-cache2" name = "fastapi-cache2"
version = "0.1.3.2" version = "0.1.3.3"
description = "Cache for FastAPI" description = "Cache for FastAPI"
authors = ["long2ice <long2ice@gmail.com>"] authors = ["long2ice <long2ice@gmail.com>"]
license = "Apache-2.0" license = "Apache-2.0"