BITOP

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

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).
Related commands SETBIT, GETBIT, BITCOUNT, BITPOS
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< GETBIT BITOP BITCOUNT >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.