TOPK.RESERVE

Syntax
TOPK.RESERVE key topk [width depth decay]
Available in:
Redis Stack / Bloom 2.0.0
Time complexity:
O(1)

Initializes a TopK with specified parameters.

Parameters

  • key: Key under which the sketch is to be found.
  • topk: Number of top occurring items to keep.

Optional parameters

  • width: Number of counters kept in each array. (Default 8)
  • depth: Number of arrays. (Default 7)
  • decay: The probability of reducing a counter in an occupied bucket. It is raised to power of it's counter (decay ^ bucket[i].counter). Therefore, as the counter gets higher, the chance of a reduction is being reduced. (Default 0.9)

Return

Simple string reply - OK if executed correctly, or [] otherwise.

Examples

redis> TOPK.RESERVE topk 50 2000 7 0.925
OK

Rate this page