SETBIT

Changes one bit in a string and returns its previous value.

Bitmaps · Example verified

Syntax covered here

SETBIT key offset bit

Both setting a bit to 1 and clearing it to 0 are exercised at the same offset.

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
> SETBIT bits 1 0
1