Trait rustis::commands::CountMinSketchCommands

source ·
pub trait CountMinSketchCommands<'a> {
    // Provided methods
    fn cms_incrby<I: SingleArg, R: CollectionResponse<usize>>(
        self,
        key: impl SingleArg,
        items: impl KeyValueArgsCollection<I, usize>
    ) -> PreparedCommand<'a, Self, R>
       where Self: Sized { ... }
    fn cms_info(
        self,
        key: impl SingleArg
    ) -> PreparedCommand<'a, Self, CmsInfoResult>
       where Self: Sized { ... }
    fn cms_initbydim(
        self,
        key: impl SingleArg,
        width: usize,
        depth: usize
    ) -> PreparedCommand<'a, Self, ()>
       where Self: Sized { ... }
    fn cms_initbyprob(
        self,
        key: impl SingleArg,
        error: f64,
        probability: f64
    ) -> PreparedCommand<'a, Self, ()>
       where Self: Sized { ... }
    fn cms_merge<S: SingleArg, W: SingleArgCollection<usize>>(
        self,
        destination: impl SingleArg,
        sources: impl SingleArgCollection<S>,
        weights: Option<W>
    ) -> PreparedCommand<'a, Self, ()>
       where Self: Sized { ... }
    fn cms_query<I: SingleArg, C: CollectionResponse<usize>>(
        self,
        key: impl SingleArg,
        items: impl SingleArgCollection<I>
    ) -> PreparedCommand<'a, Self, C>
       where Self: Sized { ... }
}
Available on crate feature redis-bloom only.
Expand description

A group of Redis commands related to Count-min Sketch

§See Also

Count-min Sketch Commands

Provided Methods§

source

fn cms_incrby<I: SingleArg, R: CollectionResponse<usize>>( self, key: impl SingleArg, items: impl KeyValueArgsCollection<I, usize> ) -> PreparedCommand<'a, Self, R>
where Self: Sized,

Increases the count of item by increment.

Multiple items can be increased with one call.

§Arguments
  • key - The name of the sketch.
  • items - A collection of tuples of
    • item - The item which counter is to be increased.
    • increment- Amount by which the item counter is to be increased.
§Return

A collection of count of each item after increment.

§See Also
source

fn cms_info( self, key: impl SingleArg ) -> PreparedCommand<'a, Self, CmsInfoResult>
where Self: Sized,

Returns width, depth and total count of the sketch.

§Arguments
  • key - The name of the sketch.
§See Also
source

fn cms_initbydim( self, key: impl SingleArg, width: usize, depth: usize ) -> PreparedCommand<'a, Self, ()>
where Self: Sized,

Initializes a Count-Min Sketch to dimensions specified by user.

Multiple items can be increased with one call.

§Arguments
  • key - The name of the sketch.
  • width - Number of counters 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).
§See Also
source

fn cms_initbyprob( self, key: impl SingleArg, error: f64, probability: f64 ) -> PreparedCommand<'a, Self, ()>
where Self: Sized,

Initializes a Count-Min Sketch to accommodate requested tolerances.

§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.
§See Also
source

fn cms_merge<S: SingleArg, W: SingleArgCollection<usize>>( self, destination: impl SingleArg, sources: impl SingleArgCollection<S>, weights: Option<W> ) -> PreparedCommand<'a, Self, ()>
where Self: Sized,

Returns the count for one or more items in a sketch.

All sketches must have identical width and depth. Weights can be used to multiply certain sketches. Default weight is 1.

§Arguments
  • destination - The name of destination sketch. Must be initialized.
  • sources - Names of source sketches to be merged.
  • weights - Multiple of each sketch. Default =1.
§See Also
source

fn cms_query<I: SingleArg, C: CollectionResponse<usize>>( self, key: impl SingleArg, items: impl SingleArgCollection<I> ) -> PreparedCommand<'a, Self, C>
where Self: Sized,

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.

§Arguments
  • key - The name of the sketch.
  • item - One or more items for which to return the count.
§Return

Count of one or more items

§See Also

Implementors§

source§

impl<'a> CountMinSketchCommands<'a> for &'a Client

source§

impl<'a> CountMinSketchCommands<'a> for &'a mut Transaction

source§

impl<'a, 'b> CountMinSketchCommands<'a> for &'a mut Pipeline<'b>