mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-24 20:47:54 +00:00
These arguments are never set to None so don't need to be optional. They are always a tuple and a dict but can be empty.
22 lines
521 B
Python
22 lines
521 B
Python
from typing import Any, Awaitable, Callable, Optional, Protocol, Union
|
|
|
|
from starlette.requests import Request
|
|
from starlette.responses import Response
|
|
|
|
|
|
_Func = Callable[..., Any]
|
|
|
|
|
|
class KeyBuilder(Protocol):
|
|
def __call__(
|
|
self,
|
|
_function: _Func,
|
|
_namespace: str = ...,
|
|
*,
|
|
request: Optional[Request] = ...,
|
|
response: Optional[Response] = ...,
|
|
args: tuple[Any, ...] = ...,
|
|
kwargs: dict[str, Any] = ...,
|
|
) -> Union[Awaitable[str], str]:
|
|
...
|