Skip to content

RedisList

RedisList

RedisList(type: Literal['white', 'black'], redis_instance: Redis, in_list_life_time: int | None)

Bases: ABCList

Black/White lists in Redis, most optimal format.

Dependency required: pip install jamlib[redis-lists]

Attributes:

Name Type Description
__list__ Redis

Redis instance

exp int | None

Token lifetime

Parameters:

Name Type Description Default
type Literal['white', 'black']

Type og list

required
redis_instance Redis

redis.Redis

required
in_list_life_time int | None

The lifetime of a token in the list

required

Methods:

Name Description
add

Method for adding token to list.

check

Method for checking if a token is present in the list.

delete

Method for removing a token from a list.

add

add(token: str) -> None

Method for adding token to list.

Parameters:

Name Type Description Default
token str

Your JWT token

required

Returns:

Type Description
None

(None)

check

check(token: str) -> bool

Method for checking if a token is present in the list.

Parameters:

Name Type Description Default
token str

Your JWT token

required

Returns:

Type Description
bool

(bool)

delete

delete(token: str) -> None

Method for removing a token from a list.

Parameters:

Name Type Description Default
token str

Your JWT token

required

Returns:

Type Description
None

None