BITCOUNT

Counts set bits in a string value.

Bitmaps · Example verified

Syntax covered here

BITCOUNT key

The whole-value form is verified after enabling one bit with SETBIT.

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
> BITCOUNT bits
1