Skip to content

R64.CONTAINS

CategoryDescription
SyntaxR64.CONTAINS key1 key2 [ALL, ALL_STRICT, EQ]
Time complexityO(C)
Supports structuresBitmap64
Command descriptionCheck whether two bitmaps intersect.

Parameter

  • key1: The name of the Roaring bitmap key.
  • key2: The name of the Roaring bitmap key.
  • ALL: If this parameter is specified, returns 1 when all the elements of key2 are also in key1.
  • ALL_STRICT: If this parameter is specified, returns 1 when all the elements of key2 are also in key1, and key2 is strictly less than key1.
  • EQ: If this parameter is specified, returns 1 when the two bitmaps contain the same elements.

Output

  • If the operation is successful:
    • If key1 contains key2, a value of 1 is returned.
    • If key1 does not contain key2, a value of 0 is returned.
  • Otherwise, an error message is returned.

Examples

Basic Usage

bash
$ redis-cli
127.0.0.1:6379> R64.SETINTARRAY foo1 1 2 3
OK

127.0.0.1:6379> R64.SETINTARRAY foo2 2 3 4
OK

# 2 3 existed in key1
R64.CONTAINS foo1 foo2
(integer) 1

# 4 missed in key1
R64.CONTAINS foo1 foo2 ALL
(integer) 0