MCPcopy Index your code
hub / github.com/long2ice/fastapi-cache / init

Method init

fastapi_cache/__init__.py:30–49  ·  view source on GitHub ↗
(
        cls,
        backend: Backend,
        prefix: str = "",
        expire: Optional[int] = None,
        coder: Type[Coder] = JsonCoder,
        key_builder: KeyBuilder = default_key_builder,
        cache_status_header: str = "X-FastAPI-Cache",
        enable: bool = True,
    )

Source from the content-addressed store, hash-verified

28
29 @classmethod
30 def init(
31 cls,
32 backend: Backend,
33 prefix: str = "",
34 expire: Optional[int] = None,
35 coder: Type[Coder] = JsonCoder,
36 key_builder: KeyBuilder = default_key_builder,
37 cache_status_header: str = "X-FastAPI-Cache",
38 enable: bool = True,
39 ) -> None:
40 if cls._init:
41 return
42 cls._init = True
43 cls._backend = backend
44 cls._prefix = prefix
45 cls._expire = expire
46 cls._coder = coder
47 cls._key_builder = key_builder
48 cls._cache_status_header = cache_status_header
49 cls._enable = enable
50
51 @classmethod
52 def reset(cls) -> None:

Callers 3

_init_cacheFunction · 0.45
lifespanFunction · 0.45
lifespanFunction · 0.45

Calls

no outgoing calls

Tested by 1

_init_cacheFunction · 0.36