CMS.INITBYPROB

CMS.INITBYPROB key error probability [CELL_SIZE cell_size]
Available in:
Redis Open Source / Bloom 2.0.0
Time complexity:
O(1)
ACL categories:
@cms, @write, @fast,
Compatibility:
Redis Software and Redis Cloud compatibility

Initializes a Count-Min Sketch to accommodate requested tolerances.

Required arguments

key

The name of the sketch.

error

Estimate size of error. The error is a percent of total counted items. This effects the width of the sketch.

probability

The desired probability for inflated count. This should be a decimal value between 0 and 1. This effects the depth of the sketch. For example, for a desired false positive rate of 0.1% (1 in 1000), error_rate should be set to 0.001. The closer this number is to zero, the greater the memory consumption per item and the more CPU usage per operation.

Optional arguments

CELL_SIZE cell_size

The size, in bytes, of each counter in the sketch. Valid values are 1, 2, 4, or 8. A smaller cell size reduces memory usage but lowers the maximum count a cell can hold before overflowing. A larger cell size supports higher counts at the cost of more memory. Default is 4.

Examples

redis> CMS.INITBYPROB test 0.001 0.01
OK
redis> CMS.INITBYPROB test2 0.001 0.01 CELL_SIZE 1
OK

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Supported
✅ Flexible & Annual
✅ Free & Fixed

Return information

One of the following:

RATE THIS PAGE
Back to top ↑