Bitfield operations

class BitFieldOperation(redis_client: AbstractExecutor, key: KeyT, readonly: bool = False)[source]

The command treats a Redis string as a array of bits, and is capable of addressing specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset.

The supported types are up to 64 bits for signed integers, and up to 63 bits for unsigned integers.

Offset can be num prefixed with # character or num directly.

Redis command documentation: BITFIELD

set(encoding: str, offset: int | str, value: int) BitFieldOperation[source]

Set the specified bit field and returns its old value.

get(encoding: str, offset: int | str) BitFieldOperation[source]

Returns the specified bit field.

incrby(encoding: str, offset: int | str, increment: int) BitFieldOperation[source]

Increments or decrements (if a negative increment is given) the specified bit field and returns the new value.

overflow(behavior: Literal[PureToken.SAT, PureToken.WRAP, PureToken.FAIL] = PureToken.SAT) BitFieldOperation[source]

fine-tune the behavior of the increment or decrement overflow, have no effect unless used before incrby() three behavior types are available: WRAP|SAT|FAIL

async exc() ResponseType[source]

execute commands in command stack