Trait SortedSetCommands

Source
pub trait SortedSetCommands<'a> {
Show 34 methods // Provided methods fn zadd<K, M, I>( self, key: K, items: I, options: ZAddOptions, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, M: SingleArg, I: MultipleArgsCollection<(f64, M)> { ... } fn zadd_incr<K, M>( self, key: K, condition: ZAddCondition, comparison: ZAddComparison, change: bool, score: f64, member: M, ) -> PreparedCommand<'a, Self, Option<f64>> where Self: Sized, K: SingleArg, M: SingleArg { ... } fn zcard<K>(self, key: K) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg { ... } fn zcount<K, M1, M2>( self, key: K, min: M1, max: M2, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, M1: SingleArg, M2: SingleArg { ... } fn zdiff<K, C, E>(self, keys: C) -> PreparedCommand<'a, Self, Vec<E>> where Self: Sized, K: SingleArg, C: SingleArgCollection<K>, E: PrimitiveResponse + DeserializeOwned { ... } fn zdiff_with_scores<K, C, E>( self, keys: C, ) -> PreparedCommand<'a, Self, Vec<(E, f64)>> where Self: Sized, K: SingleArg, C: SingleArgCollection<K>, E: PrimitiveResponse + DeserializeOwned { ... } fn zdiffstore<D, K, C>( self, destination: D, keys: C, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, D: SingleArg, K: SingleArg, C: SingleArgCollection<K> { ... } fn zincrby<K, M>( self, key: K, increment: f64, member: M, ) -> PreparedCommand<'a, Self, f64> where Self: Sized, K: SingleArg, M: SingleArg { ... } fn zinter<K, C, W, E>( self, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, Vec<E>> where Self: Sized, K: SingleArg, C: SingleArgCollection<K>, W: SingleArgCollection<f64>, E: PrimitiveResponse + DeserializeOwned { ... } fn zinter_with_scores<K, C, W, E>( self, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, Vec<(E, f64)>> where Self: Sized, K: SingleArg, C: SingleArgCollection<K>, W: SingleArgCollection<f64>, E: PrimitiveResponse + DeserializeOwned { ... } fn zintercard<K, C>( self, keys: C, limit: usize, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, C: SingleArgCollection<K> { ... } fn zinterstore<D, K, C, W>( self, destination: D, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, D: SingleArg, K: SingleArg, C: SingleArgCollection<K>, W: SingleArgCollection<f64> { ... } fn zlexcount<K, M1, M2>( self, key: K, min: M1, max: M2, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, M1: SingleArg, M2: SingleArg { ... } fn zmpop<K, C, E>( self, keys: C, where_: ZWhere, count: usize, ) -> PreparedCommand<'a, Self, Option<ZMPopResult<E>>> where Self: Sized, K: SingleArg, C: SingleArgCollection<K>, E: PrimitiveResponse + DeserializeOwned { ... } fn zmscore<K, M, C>( self, key: K, members: C, ) -> PreparedCommand<'a, Self, Vec<Option<f64>>> where Self: Sized, K: SingleArg, M: SingleArg, C: SingleArgCollection<M> { ... } fn zpopmax<K, M>( self, key: K, count: usize, ) -> PreparedCommand<'a, Self, Vec<(M, f64)>> where Self: Sized, K: SingleArg, M: PrimitiveResponse + DeserializeOwned { ... } fn zpopmin<K, M>( self, key: K, count: usize, ) -> PreparedCommand<'a, Self, Vec<(M, f64)>> where Self: Sized, K: SingleArg, M: PrimitiveResponse + DeserializeOwned { ... } fn zrandmember<K, E>(self, key: K) -> PreparedCommand<'a, Self, E> where Self: Sized, K: SingleArg, E: PrimitiveResponse { ... } fn zrandmembers<K, E>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, Vec<E>> where Self: Sized, K: SingleArg, E: PrimitiveResponse + DeserializeOwned { ... } fn zrandmembers_with_scores<K, E>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, Vec<E>> where Self: Sized, K: SingleArg, E: DeserializeOwned { ... } fn zrange<K, S, E>( self, key: K, start: S, stop: S, options: ZRangeOptions, ) -> PreparedCommand<'a, Self, Vec<E>> where Self: Sized, K: SingleArg, S: SingleArg, E: PrimitiveResponse + DeserializeOwned { ... } fn zrange_with_scores<K, S, E>( self, key: K, start: S, stop: S, options: ZRangeOptions, ) -> PreparedCommand<'a, Self, Vec<(E, f64)>> where Self: Sized, K: SingleArg, S: SingleArg, E: PrimitiveResponse + DeserializeOwned { ... } fn zrangestore<D, S, SS>( self, dst: D, src: S, start: SS, stop: SS, options: ZRangeOptions, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, D: SingleArg, S: SingleArg, SS: SingleArg { ... } fn zrank<K, M>( self, key: K, member: M, ) -> PreparedCommand<'a, Self, Option<usize>> where Self: Sized, K: SingleArg, M: SingleArg { ... } fn zrem<K, M, C>( self, key: K, members: C, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, M: SingleArg, C: SingleArgCollection<M> { ... } fn zremrangebylex<K, S>( self, key: K, start: S, stop: S, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, S: SingleArg { ... } fn zremrangebyrank<K>( self, key: K, start: isize, stop: isize, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg { ... } fn zremrangebyscore<K, S>( self, key: K, start: S, stop: S, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, S: SingleArg { ... } fn zrevrank<K, M>( self, key: K, member: M, ) -> PreparedCommand<'a, Self, Option<usize>> where Self: Sized, K: SingleArg, M: SingleArg { ... } fn zscan<K, M>( self, key: K, cursor: usize, options: ZScanOptions, ) -> PreparedCommand<'a, Self, ZScanResult<M>> where Self: Sized, K: SingleArg, M: PrimitiveResponse + DeserializeOwned { ... } fn zscore<K, M>( self, key: K, member: M, ) -> PreparedCommand<'a, Self, Option<f64>> where Self: Sized, K: SingleArg, M: SingleArg { ... } fn zunion<K, C, W, E>( self, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, Vec<E>> where Self: Sized, K: SingleArg, C: SingleArgCollection<K>, W: SingleArgCollection<f64>, E: PrimitiveResponse + DeserializeOwned { ... } fn zunion_with_scores<K, C, W, E>( self, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, Vec<(E, f64)>> where Self: Sized, K: SingleArg, C: SingleArgCollection<K>, W: SingleArgCollection<f64>, E: PrimitiveResponse + DeserializeOwned { ... } fn zunionstore<D, K, C, W>( self, destination: D, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, D: SingleArg, K: SingleArg, C: SingleArgCollection<K>, W: SingleArgCollection<f64> { ... }
}
Expand description

A group of Redis commands related to Sorted Sets

§See Also

Redis Sorted Set Commands

Provided Methods§

Source

fn zadd<K, M, I>( self, key: K, items: I, options: ZAddOptions, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, M: SingleArg, I: MultipleArgsCollection<(f64, M)>,

Adds all the specified members with the specified scores to the sorted set stored at key.

§Return
  • When used without optional arguments, the number of elements added to the sorted set (excluding score updates).
  • If the change option is specified, the number of elements that were changed (added or updated).
§See Also

https://redis.io/commands/zadd/

Source

fn zadd_incr<K, M>( self, key: K, condition: ZAddCondition, comparison: ZAddComparison, change: bool, score: f64, member: M, ) -> PreparedCommand<'a, Self, Option<f64>>
where Self: Sized, K: SingleArg, M: SingleArg,

In this mode ZADD acts like ZINCRBY. Only one score-element pair can be specified in this mode.

§Return

The new score of member (a double precision floating point number), or nil if the operation was aborted (when called with either the XX or the NX option).

§See Also

https://redis.io/commands/zadd/

Source

fn zcard<K>(self, key: K) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg,

Returns the sorted set cardinality (number of elements) of the sorted set stored at key.

§Return

The cardinality (number of elements) of the sorted set, or 0 if key does not exist.

§See Also

https://redis.io/commands/zcard/

Source

fn zcount<K, M1, M2>( self, key: K, min: M1, max: M2, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, M1: SingleArg, M2: SingleArg,

Returns the number of elements in the sorted set at key with a score between min and max.

§Return

The number of elements in the specified score range.

§See Also

https://redis.io/commands/zcount/

Source

fn zdiff<K, C, E>(self, keys: C) -> PreparedCommand<'a, Self, Vec<E>>

This command is similar to zdiffstore, but instead of storing the resulting sorted set, it is returned to the client.

§Return

The result of the difference

§See Also

https://redis.io/commands/zdiff/

Source

fn zdiff_with_scores<K, C, E>( self, keys: C, ) -> PreparedCommand<'a, Self, Vec<(E, f64)>>

This command is similar to zdiffstore, but instead of storing the resulting sorted set, it is returned to the client.

§Return

The result of the difference with their scores

§See Also

https://redis.io/commands/zdiff/

Source

fn zdiffstore<D, K, C>( self, destination: D, keys: C, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, D: SingleArg, K: SingleArg, C: SingleArgCollection<K>,

Computes the difference between the first and all successive input sorted sets and stores the result in destination.

§Return

The number of elements in the resulting sorted set at destination.

§See Also

https://redis.io/commands/zdiffstore/

Source

fn zincrby<K, M>( self, key: K, increment: f64, member: M, ) -> PreparedCommand<'a, Self, f64>
where Self: Sized, K: SingleArg, M: SingleArg,

Increments the score of member in the sorted set stored at key by increment.

§Return

the new score of member

§See Also

https://redis.io/commands/zincrby/

Source

fn zinter<K, C, W, E>( self, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, Vec<E>>

This command is similar to zinterstore, but instead of storing the resulting sorted set, it is returned to the client.

§Return

The result of the intersection as an array of members

§See Also

https://redis.io/commands/zinter/

Source

fn zinter_with_scores<K, C, W, E>( self, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, Vec<(E, f64)>>

This command is similar to zinterstore, but instead of storing the resulting sorted set, it is returned to the client.

§Return

The result of the intersection as an array of members with their scores

§See Also

https://redis.io/commands/zinter/

Source

fn zintercard<K, C>( self, keys: C, limit: usize, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, C: SingleArgCollection<K>,

This command is similar to zinter, but instead of returning the result set, it returns just the cardinality of the result.

the algorithm will exit and yield limit as the cardinality. 0 means unlimited

§See Also

https://redis.io/commands/zintercard/

Source

fn zinterstore<D, K, C, W>( self, destination: D, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, usize>

Computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.

§Return

The number of elements in the resulting sorted set at destination.

§See Also

https://redis.io/commands/zinterstore/

Source

fn zlexcount<K, M1, M2>( self, key: K, min: M1, max: M2, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, M1: SingleArg, M2: SingleArg,

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns the number of elements in the sorted set at key with a value between min and max.

§Return

the number of elements in the specified score range.

§See Also

https://redis.io/commands/zlexcount/

Source

fn zmpop<K, C, E>( self, keys: C, where_: ZWhere, count: usize, ) -> PreparedCommand<'a, Self, Option<ZMPopResult<E>>>

Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.

§Return
  • None if no element could be popped
  • A tuple made up of
    • The name of the key from which elements were popped
    • An array of tuples with all the popped members and their scores
§See Also

https://redis.io/commands/zmpop/

Source

fn zmscore<K, M, C>( self, key: K, members: C, ) -> PreparedCommand<'a, Self, Vec<Option<f64>>>
where Self: Sized, K: SingleArg, M: SingleArg, C: SingleArgCollection<M>,

Returns the scores associated with the specified members in the sorted set stored at key.

For every member that does not exist in the sorted set, a nil value is returned.

§Return

The list of scores or nil associated with the specified member value

§See Also

https://redis.io/commands/zmscore/

Source

fn zpopmax<K, M>( self, key: K, count: usize, ) -> PreparedCommand<'a, Self, Vec<(M, f64)>>

Removes and returns up to count members with the highest scores in the sorted set stored at key.

§Return

The list of popped elements and scores.

§See Also

https://redis.io/commands/zpopmax/

Source

fn zpopmin<K, M>( self, key: K, count: usize, ) -> PreparedCommand<'a, Self, Vec<(M, f64)>>

Removes and returns up to count members with the lowest scores in the sorted set stored at key.

§Return

The list of popped elements and scores.

§See Also

https://redis.io/commands/zpopmin/

Source

fn zrandmember<K, E>(self, key: K) -> PreparedCommand<'a, Self, E>
where Self: Sized, K: SingleArg, E: PrimitiveResponse,

Return a random element from the sorted set value stored at key.

§Return

The randomly selected element, or nil when key does not exist.

§See Also

https://redis.io/commands/zrandmember/

Source

fn zrandmembers<K, E>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, Vec<E>>

Return random elements from the sorted set value stored at key.

§Return
  • If the provided count argument is positive, return an array of distinct elements. The array’s length is either count or the sorted set’s cardinality (ZCARD), whichever is lower.
  • If called with a negative count, the behavior changes and the command is allowed to return the same element multiple times. In this case, the number of returned elements is the absolute value of the specified count.
§See Also

https://redis.io/commands/zrandmember/

Source

fn zrandmembers_with_scores<K, E>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, Vec<E>>
where Self: Sized, K: SingleArg, E: DeserializeOwned,

Return random elements with their scores from the sorted set value stored at key.

§Return
  • If the provided count argument is positive, return an array of distinct elements with their scores. The array’s length is either count or the sorted set’s cardinality (ZCARD), whichever is lower.
  • If called with a negative count, the behavior changes and the command is allowed to return the same element multiple times. In this case, the number of returned elements is the absolute value of the specified count.
§See Also

https://redis.io/commands/zrandmember/

Source

fn zrange<K, S, E>( self, key: K, start: S, stop: S, options: ZRangeOptions, ) -> PreparedCommand<'a, Self, Vec<E>>

Returns the specified range of elements in the sorted set stored at key.

§Return

A collection of elements in the specified range

§See Also

https://redis.io/commands/zrange/

Source

fn zrange_with_scores<K, S, E>( self, key: K, start: S, stop: S, options: ZRangeOptions, ) -> PreparedCommand<'a, Self, Vec<(E, f64)>>

Returns the specified range of elements in the sorted set stored at key.

§Return

A collection of elements and their scores in the specified range

§See Also

https://redis.io/commands/zrange/

Source

fn zrangestore<D, S, SS>( self, dst: D, src: S, start: SS, stop: SS, options: ZRangeOptions, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, D: SingleArg, S: SingleArg, SS: SingleArg,

This command is like zrange, but stores the result in the dst destination key.

§Return

The number of elements in the resulting sorted set.

§See Also

https://redis.io/commands/zrangestore/

Source

fn zrank<K, M>( self, key: K, member: M, ) -> PreparedCommand<'a, Self, Option<usize>>
where Self: Sized, K: SingleArg, M: SingleArg,

Returns the rank of member in the sorted set stored at key, with the scores ordered from low to high.

§Return
  • If member exists in the sorted set, the rank of member.
  • If member does not exist in the sorted set or key does not exist, None.
§See Also

https://redis.io/commands/zrank/

Source

fn zrem<K, M, C>(self, key: K, members: C) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, M: SingleArg, C: SingleArgCollection<M>,

Removes the specified members from the sorted set stored at key.

§Return

The number of members removed from the sorted set, not including non existing members.

§See Also

https://redis.io/commands/zrem/

Source

fn zremrangebylex<K, S>( self, key: K, start: S, stop: S, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, S: SingleArg,

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command removes all elements in the sorted set stored at key between the lexicographical range specified by min and max.

§Return

the number of elements removed.

§See Also

https://redis.io/commands/zremrangebylex/

Source

fn zremrangebyrank<K>( self, key: K, start: isize, stop: isize, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg,

Removes all elements in the sorted set stored at key with rank between start and stop.

§Return

the number of elements removed.

§See Also

https://redis.io/commands/zremrangebyrank/

Source

fn zremrangebyscore<K, S>( self, key: K, start: S, stop: S, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, S: SingleArg,

Removes all elements in the sorted set stored at key with a score between min and max (inclusive).

§Return

the number of elements removed.

§See Also

https://redis.io/commands/zremrangebyscore/

Source

fn zrevrank<K, M>( self, key: K, member: M, ) -> PreparedCommand<'a, Self, Option<usize>>
where Self: Sized, K: SingleArg, M: SingleArg,

Returns the rank of member in the sorted set stored at key, with the scores ordered from high to low.

§Return
  • If member exists in the sorted set, the rank of member.
  • If member does not exist in the sorted set or key does not exist, None.
§See Also

https://redis.io/commands/zrevrank/

Source

fn zscan<K, M>( self, key: K, cursor: usize, options: ZScanOptions, ) -> PreparedCommand<'a, Self, ZScanResult<M>>

Iterates elements of Sorted Set types and their associated scores.

§Returns

A tuple where

  • The first value is the cursor as an unsigned 64 bit number
  • The second value is a list of members and their scores in a Vec of Tuples
§See Also

https://redis.io/commands/zscan/

Source

fn zscore<K, M>( self, key: K, member: M, ) -> PreparedCommand<'a, Self, Option<f64>>
where Self: Sized, K: SingleArg, M: SingleArg,

Returns the score of member in the sorted set at key.

§Return

The score of member or nil if keydoes not exist

§See Also

https://redis.io/commands/zscore/

Source

fn zunion<K, C, W, E>( self, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, Vec<E>>

This command is similar to zunionstore, but instead of storing the resulting sorted set, it is returned to the client.

§Return

The result of the unionsection as an array of members

§See Also

https://redis.io/commands/zunion/

Source

fn zunion_with_scores<K, C, W, E>( self, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, Vec<(E, f64)>>

This command is similar to zunionstore, but instead of storing the resulting sorted set, it is returned to the client.

§Return

The result of the unionsection as an array of members with their scores

§See Also

https://redis.io/commands/zunion/

Source

fn zunionstore<D, K, C, W>( self, destination: D, keys: C, weights: Option<W>, aggregate: ZAggregate, ) -> PreparedCommand<'a, Self, usize>

Computes the unionsection of numkeys sorted sets given by the specified keys, and stores the result in destination.

§Return

The number of elements in the resulting sorted set at destination.

§See Also

https://redis.io/commands/zunionstore/

Implementors§

Source§

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

Source§

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

Source§

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