SETBIT
Syntax
SETBIT key offset value
Time complexity: O(1)
Sets or clears the bit at offset (zero-indexed) in the string value stored at key.
The bit is either set or cleared depending on value, which can be either 0 or 1.
When key does not exist, a new string value is created. The string is grown to make sure it can hold a bit at offset. The offset argument is required to be greater than or equal to 0, and smaller than 232 (this limits bitmaps to 512MB). When the string at key is grown, added bits are set to 0.
Warning: When setting the last possible bit (offset equal to 232-1), and the string value stored at key does not holds a value (or holds a small string), the operation will take some time, as Dragonfly is required to allocate all memory leading to that bit. Subsequent calls will not have the performance penalty.
Return
Integer reply: the original bit value stored at offset.
Examples
dragonfly> SETBIT mykey 7 1
(integer) 0
dragonfly> SETBIT mykey 7 0
(integer) 1
dragonfly> GET mykey
"