YouTip LogoYouTip

Strings Getbit

# Redis Getbit Command [!(#) Redis Strings(string)](#)") The Redis Getbit command is used to get the bit at a specified offset in the string value stored at a key. ### Syntax The basic syntax of the redis Getbit command is as follows: redis 127.0.0.1:6379> GETBIT KEY_NAME OFFSET ### Available Version >= 2.2.0 ### Return Value The bit at the specified offset in the string value. Returns 0 when the offset OFFSET is greater than the length of the string value, or when the key does not exist. ### Example # GETBIT on a non-existent key or offset returns 0 redis> EXISTS bit (integer) 0 redis> GETBIT bit 10086(integer) 0# GETBIT on an existing offset redis> SETBIT bit 10086 1(integer) 0 redis> GETBIT bit 10086(integer) 1 [!(#) Redis Strings(string)](#)")
← Strings MgetStrings Getset β†’