Skip to main content

CMS.INITBYPROB

Syntax

CMS.INITBYPROB key error probability

Time complexity: O(1)

ACL categories: @cms

Initializes a Count-Min Sketch filter at key with dimensions automatically calculated from the desired error rate and probability of accuracy.

  • error: The desired error rate as a fraction of the total count. Must be a positive number between 0 and 1. For example, 0.01 means the estimated count will be within 1% of the true count.
  • probability: The desired failure probability — the probability that an estimate will exceed the error bounds. Must be a positive number between 0 and 1. For example, 0.01 means there is a 1% chance the estimate exceeds the error bounds. Lower values produce a deeper sketch with fewer errors but higher memory and CPU usage.

If key already exists, an error is returned.

Return

Simple string reply: OK if the sketch was created successfully.

Examples

dragonfly> CMS.INITBYPROB cms_key 0.01 0.01
OK

See also

CMS.INITBYDIM | CMS.INCRBY | CMS.QUERY | CMS.INFO