mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 13:07:53 +00:00
22 lines
541 B
Python
22 lines
541 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: Optional[tuple[Any, ...]] = ...,
|
||
|
|
kwargs: Optional[dict[str, Any]] = ...,
|
||
|
|
) -> Union[Awaitable[str], str]:
|
||
|
|
...
|