faust.web.cache.cache
¶
Cache interface.
- class faust.web.cache.cache.Cache(timeout: Optional[Union[timedelta, float, str]] = None, include_headers: bool = False, key_prefix: Optional[str] = None, backend: Optional[Union[Type[CacheBackendT], str]] = None, **kwargs: Any)[source]¶
Cache interface.
- view(timeout: Optional[Union[timedelta, float, str]] = None, include_headers: bool = False, key_prefix: Optional[str] = None, **kwargs: Any) Callable[[Callable], Callable] [source]¶
Decorate view to be cached.
- Return type:
_CallableGenericAlias
[_CallableType
,_CallableType
]
- async get_view(key: str, view: View) Optional[Response] [source]¶
Get cached value for HTTP view request.
- Return type:
_UnionGenericAlias
[Response
,None
]
- async set_view(key: str, view: View, response: Response, timeout: Optional[Union[timedelta, float, str]] = None) None [source]¶
Set cached value for HTTP view request.
- Return type:
None
- can_cache_request(request: Request) bool [source]¶
Return
True
if we can cache this type of HTTP request.- Return type:
- can_cache_response(request: Request, response: Response) bool [source]¶
Return
True
for HTTP status codes we CAN cache.- Return type: