Redis - String Getbit Command


Advertisements

Redis GETBIT command is used to get the bit value at the offset in the string value stored at the key.

Return Value

Integer, the bit value stored at the offset.

Syntax

Following is the basic syntax of Redis GETBIT command.

redis 127.0.0.1:6379> GETBIT KEY_NAME OFFSET

Example

redis 127.0.0.1:6379> SETBIT mykey 7 1 
(integer) 0 
redis 127.0.0.1:6379> GETBIT mykey 0 
(integer) 0 
redis 127.0.0.1:6379> GETBIT mykey 7 
(integer) 1 
redis 127.0.0.1:6379> GETBIT mykey 100
(integer) 0 
redis_strings.htm
Advertisements