Redis String: Getbit
Getbit key offset
Redis GETBIT command is used to get the bit value at offset in the string value stored at key. When an offset is beyond the string length, the string is assumed to be a contiguous space with 0 bits. When a key does not exist it is assumed to be an empty string, so the offset is always out of range and the value is also assumed to be a contiguous space with 0 bits.
Syntax:
GETBIT KEY_NAME OFFSET
Available since
2.2.0.
Return Value
Integer, the bit value stored at offset.
Return Value Type
Integer
Example: Redis GETBIT
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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework