Skip to content

R64.BITOP

CategoryDescription
SyntaxR64.BITOP <AND, OR, XOR, NOT, ANDOR, ONE> destkey key [key1 key2 ... keyN]
Time complexityO(C)
Supports structuresBitmap64
Command descriptionPerforms set operations on Roaring Bitmaps and stores the result in destkey.

Parameter

  • operation: The type of set operation.
  • destkey: The destination key that stores the result (Roaring data structure).
  • key: The key of the Roaring data structure. You can specify multiple keys.

Output

  • If the operation is successful, the big number of bits in the result that are set to 1 is returned.
  • Otherwise, an error message is returned.

Examples

Basic Usage

$ redis-cli
127.0.0.1:6379> R64.BITOP OR destkey srckey1 srckey2 srckey3
"6"

Usage Notes

  • Empty source keys are automatically skipped during the bitwise operation
  • All keys must be of the same Roaring bitmap type (Bitmap64)
  • The operation creates the destination key if it doesn't exist
  • To properly handle bigint values, use RESP3 protocol; otherwise the result will be returned as a string