redis GETBIT command
Translation results:
get
英[get] 美[ɡɛt]
vt. Get; catch; persuade; receive (punishment, etc.)
vt.& vi. Arrive, come
vi. Become; start; try to deal with; obtain benefits or wealth
n. Reproduce, cub; profit
Third person singular : gets present participle: getting past tense: got past participle: got gotten
bit
##英[bɪt] 美[bɪt] n. A little, a piece; a small amount, a little; a while, a blink of an eye; [count] bit (binary information unit) adj. very small, insignificant adv. [colloquial] quite , a little, more or less, how much [a bit to is omitted]vt. To put a bit on (the horse); to put on the bit; to restrain; to restrict v. bite, bite ( past tense of bite); stinging; biting bait; habit of biting (or stinging) Third person singular: bits Plural: bits Present participle: bitting Past tense: bitted Past participle: bittedredis GETBIT commandsyntax
Function: Get the bit at the specified offset for the string value stored in key. When offset is greater than the length of the string value, or key does not exist, 0 is returned.
Syntax: GETBIT key offset
Available versions:>= 2.2.0
Time complexity : O(1)
Return: The bit at the specified offset of the string value.
redis GETBIT commandexample
# 对不存在的 key 或者不存在的 offset 进行 GETBIT, 返回 0 redis> EXISTS bit (integer) 0 redis> GETBIT bit 10086 (integer) 0 # 对已存在的 offset 进行 GETBIT redis> SETBIT bit 10086 1 (integer) 0 redis> GETBIT bit 10086 (integer) 1