MCPcopy
hub / github.com/long2ice/fastapi-cache / default_key_builder

Function default_key_builder

fastapi_cache/key_builder.py:8–20  ·  view source on GitHub ↗
(
    func: Callable[..., Any],
    namespace: str = "",
    *,
    request: Optional[Request] = None,
    response: Optional[Response] = None,
    args: Tuple[Any, ...],
    kwargs: Dict[str, Any],
)

Source from the content-addressed store, hash-verified

6
7
8def default_key_builder(
9 func: Callable[..., Any],
10 namespace: str = "",
11 *,
12 request: Optional[Request] = None,
13 response: Optional[Response] = None,
14 args: Tuple[Any, ...],
15 kwargs: Dict[str, Any],
16) -> str:
17 cache_key = hashlib.md5( # noqa: S324
18 f"{func.__module__}:{func.__name__}:{args}:{kwargs}".encode()
19 ).hexdigest()
20 return f"{namespace}:{cache_key}"

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected