Skip to content

R64.BITCOUNT

CategoryDescription
SyntaxR64.BITCOUNT key
Time complexityO(M)
Supports structuresBitmap64
Command descriptionCounts the number of bits that have a value of 1

Parameter

  • key: The key of the Roaring data structure.

Output

  • If the operation is successful, the integer 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.SETINTARRAY foo 1 2 3
127.0.0.1:6379> R64.BITCOUNT foo
"3"

Usage Notes

  • To properly handle bigint values, use RESP3 protocol; otherwise the result will be returned as a string