bitop
BITOP
BIT operation
Usage is bitop operation destkey key1 key2.
operation is AND, OR, XOR, or NOT.
You can use multiple src_key values.
Example
| Command> | set key1 A
|
| Result> | OK
|
| Command> | set key2 B
|
| Result> | OK
|
| Command> | bitop AND destkey key1 key2
|
| Result> | 1
|
| Command> | get destkey
|
| Result> | @
|
| Command> | bitop OR destkey key1 key2
|
| Result> | 1
|
| Command> | get destkey
|
| Result> | C
|
| Command> | bitop XOR destkey key1 key2
|
| Result> | 1
|
| Command> | get destkey
|
| Result> | \x03 redis-cli notation
|
| Command> | bitop NOT destkey key1
|
| Result> | 1
|
| Command> | get destkey
|
| Result> | \xbe redis-cli notation
|
View animation
Syntax
BITOP operation destkey key [key ...]
- Available since version 2.6.0.
- Time complexity is O(N).