Class CountMinSketchOperationsImpl<K>

java.lang.Object
com.redis.om.spring.ops.pds.CountMinSketchOperationsImpl<K>
All Implemented Interfaces:
CountMinSketchOperations<K>

public class CountMinSketchOperationsImpl<K> extends Object implements CountMinSketchOperations<K>
  • Constructor Details

    • CountMinSketchOperationsImpl

      public CountMinSketchOperationsImpl(RedisModulesClient client)
  • Method Details

    • cmsInitByDim

      public void cmsInitByDim(K key, long width, long depth)
      Description copied from interface: CountMinSketchOperations
      CMS.INITBYDIM Initializes a Count-Min Sketch to dimensions specified by user.
      Specified by:
      cmsInitByDim in interface CountMinSketchOperations<K>
      Parameters:
      key - The name of the sketch
      width - Number of counter in each array. Reduces the error size
      depth - Number of counter-arrays. Reduces the probability for an error of a certain size (percentage of total count
    • cmsInitByProb

      public void cmsInitByProb(K key, double error, double probability)
      Description copied from interface: CountMinSketchOperations
      CMS.INITBYPROB Initializes a Count-Min Sketch to accommodate requested capacity.
      Specified by:
      cmsInitByProb in interface CountMinSketchOperations<K>
      Parameters:
      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.
    • cmsIncrBy

      public long cmsIncrBy(K key, String item, long increment)
      Description copied from interface: CountMinSketchOperations
      CMS.INCRBY Increases the count of item by increment
      Specified by:
      cmsIncrBy in interface CountMinSketchOperations<K>
      Parameters:
      key - The name of the sketch
      item - The item which counter to be increased
      increment - Counter to be increased by this integer
      Returns:
      Count for the item after increment
    • cmsIncrBy

      public List<Long> cmsIncrBy(K key, Map<String,Long> itemIncrements)
      Description copied from interface: CountMinSketchOperations
      CMS.INCRBY Increases the count of one or more item.
      Specified by:
      cmsIncrBy in interface CountMinSketchOperations<K>
      Parameters:
      key - The name of the sketch
      itemIncrements - a Map of the items to be increased and their integer increment
      Returns:
      Count of each item after increment
    • cmsQuery

      public List<Long> cmsQuery(K key, String... items)
      Description copied from interface: CountMinSketchOperations
      CMS.QUERY Returns count for item. Multiple items can be queried with one call.
      Specified by:
      cmsQuery in interface CountMinSketchOperations<K>
      Parameters:
      key - The name of the sketch
      items - The items for which to retrieve the counts
      Returns:
      Count for one or more items
    • cmsMerge

      public void cmsMerge(K destKey, K... keys)
      Description copied from interface: CountMinSketchOperations
      CMS.MERGE Merges several sketches into one sketch. All sketches must have identical width and depth.
      Specified by:
      cmsMerge in interface CountMinSketchOperations<K>
      Parameters:
      destKey - The name of destination sketch. Must be initialized.
      keys - The sketches to be merged
    • cmsMerge

      public void cmsMerge(K destKey, Map<K,Long> keysAndWeights)
      Description copied from interface: CountMinSketchOperations
      CMS.MERGE Merges several sketches into one sketch. All sketches must have identical width and depth. Weights can be used to multiply certain sketches. Default weight is 1.
      Specified by:
      cmsMerge in interface CountMinSketchOperations<K>
      Parameters:
      destKey - The name of destination sketch. Must be initialized.
      keysAndWeights - A map of keys and weights used to multiply the sketch.
    • cmsInfo

      public Map<String,Object> cmsInfo(K key)
      Description copied from interface: CountMinSketchOperations
      CMS.INFO Returns width, depth and total count of the sketch.
      Specified by:
      cmsInfo in interface CountMinSketchOperations<K>
      Parameters:
      key - The name of the sketch
      Returns:
      A Map with width, depth and total count.