English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis Getbit command is used to get the bit at the specified offset of the string value stored at the key.
Basic Syntax of Redis Getbit Command
redis 127.0.0.1:6379> GETBIT KEY_NAME OFFSET
>= 2.2.0
The bit at the specified offset of the string value.
If the offset OFFSET is greater than the length of the string value or the key does not exist, returns 0.
# GETBIT for non-existing key or non-existing offset, returns 0 redis> EXISTS bit (integer) 0 redis> GETBIT bit 10086 (integer) 0 # GETBIT for existing offset redis> SETBIT bit 10086 1 (integer) 0 redis> GETBIT bit 10086 (integer) 1