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 probability that an estimate will fall within the error bounds. Must be a positive number between 0 and 1. For example, 0.999 means the estimate will be within the error bounds 99.9% of the time.

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.999
OK

See also

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