Skip to content

Global redis

T = TypeVar('T') module-attribute

r = None module-attribute

get_redis()

get_with_timeout(key, timeout, allow_none=False, default=_NOT_SET) async

Get a key with timeout.

PARAMETER DESCRIPTION
key

redis key

TYPE: str

timeout

timeout in seconds

TYPE: float

allow_none

if True, return None if key is not found

TYPE: bool DEFAULT: False

default

default value to return if key is not found.

TYPE: T DEFAULT: _NOT_SET

Returns: value of key

initialize_redis(url)

listen_with_timeout(pubsub, timeout) async

set_with_expiry(key, value, expiry) async

Set a key with expiry in seconds.

PARAMETER DESCRIPTION
key

redis key

TYPE: str

value

value to store

TYPE: str

expiry

timeout in seconds.

TYPE: int