This commit is contained in:
long2ice
2024-07-24 22:24:30 +08:00
parent 701d83fec3
commit 5f985a8506
8 changed files with 2279 additions and 1520 deletions

View File

@@ -1,14 +1,6 @@
from importlib.metadata import version
from typing import ClassVar, Optional, Type
# Because this project supports python 3.7 and up, Pyright treats importlib as
# an external library and so needs to be told to ignore the type issues it sees.
try:
# Python 3.8+
from importlib.metadata import version # type: ignore
except ImportError:
# Python 3.7
from importlib_metadata import version # type: ignore
from fastapi_cache.coder import Coder, JsonCoder
from fastapi_cache.key_builder import default_key_builder
from fastapi_cache.types import Backend, KeyBuilder

View File

@@ -29,8 +29,8 @@ _T = TypeVar("_T", bound=type)
CONVERTERS: Dict[str, Callable[[str], Any]] = {
# Pendulum 3.0.0 adds parse to __all__, at which point these ignores can be removed
"date": lambda x: pendulum.parse(x, exact=True), # type: ignore[attr-defined]
"datetime": lambda x: pendulum.parse(x, exact=True), # type: ignore[attr-defined]
"date": lambda x: pendulum.parse(x, exact=True),
"datetime": lambda x: pendulum.parse(x, exact=True),
"decimal": Decimal,
}

View File

@@ -93,6 +93,7 @@ def cache(
) -> Callable[[Callable[P, Awaitable[R]]], Callable[P, Awaitable[Union[R, Response]]]]:
"""
cache all function
:param injected_dependency_namespace:
:param namespace:
:param expire:
:param coder: