BITFIELD

Updates and reads an integer encoded in a string's bits.

Bitmaps · Example verified

Syntax covered here

BITFIELD key INCRBY u4 offset increment GET u4 offset

The tested field is an unsigned four-bit integer; GET in the same command observes the preceding increment.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> SETBIT bits 1 1
0
# connection: default
> BITFIELD bits INCRBY u4 0 1 GET u4 0
[5,5]