bit
英[bɪt] 美[bɪt]
n. A little bit, 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 omitted]
vt. To put a bit on (the horse); to put on the bit; to restrain; to restrict
v. to bite, sting (past tense of bite); to sting; to bite bait; to have a bite (or sting) Habit
Third person singular: bits Plural: bits Present participle: bitting Past tense: bitted Past participle: bitted
op
英[ɒp ] 美[ɑ:p]
n.Work, operation
plural: ops
redis BITOP command syntax
Function: Perform bit operations on one or more string keys that store binary bits, and save the results to destkey.
Syntax: BITOP operation destkey key [key ...]
Description: When BITOP handles strings of different lengths, the shorter The missing part of that string will be treated as 0 . An empty key is also treated as a sequence of strings containing 0's.
Available versions: >= 2.6.0
Time complexity: O(N)
Return: The length of the string saved to destkey is equal to the length of the longest string in the input key.
redis BITOP command example
redis> SETBIT bits-1 0 1 # bits-1 = 1001 (integer) 0 redis> SETBIT bits-1 3 1 (integer) 0 redis> SETBIT bits-2 0 1 # bits-2 = 1011 (integer) 0 redis> SETBIT bits-2 1 1 (integer) 0 redis> SETBIT bits-2 3 1 (integer) 0 redis> BITOP AND and-result bits-1 bits-2 (integer) 1 redis> GETBIT and-result 0 # and-result = 1001 (integer) 1 redis> GETBIT and-result 1 (integer) 0 redis> GETBIT and-result 2 (integer) 0 redis> GETBIT and-result 3 (integer) 1