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