public interface SortedSetCommands
Modifier and Type | Method and Description |
---|---|
KeyValue<String,List<Tuple>> |
bzmpop(long timeout,
SortedSetOption option,
int count,
String... keys) |
KeyValue<String,List<Tuple>> |
bzmpop(long timeout,
SortedSetOption option,
String... keys) |
KeyedZSetElement |
bzpopmax(double timeout,
String... keys)
The blocking version of
ZPOPMAX |
KeyedZSetElement |
bzpopmin(double timeout,
String... keys)
The blocking version of
ZPOPMIN |
long |
zadd(String key,
double score,
String member)
Add the specified member having the specified score to the sorted set stored at key.
|
long |
zadd(String key,
double score,
String member,
ZAddParams params)
Similar to
ZADD but can be used with optional params. |
long |
zadd(String key,
Map<String,Double> scoreMembers)
Similar to
ZADD but for multiple members. |
long |
zadd(String key,
Map<String,Double> scoreMembers,
ZAddParams params)
Similar to
ZADD but can be used with optional params,
and fits for multiple members. |
Double |
zaddIncr(String key,
double score,
String member,
ZAddParams params)
Increments the score of member in the sorted set stored at key by increment.
|
long |
zcard(String key)
Return the sorted set cardinality (number of elements).
|
long |
zcount(String key,
double min,
double max)
Return the number of elements in the sorted set at key with a score between min and max.
|
long |
zcount(String key,
String min,
String max)
Similar to
ZCOUNT but with exclusive range. |
Set<String> |
zdiff(String... keys)
Compute the difference between all the sets in the given keys.
|
long |
zdiffStore(String dstkey,
String... keys)
Compute the difference between all the sets in the given keys.
|
Set<Tuple> |
zdiffWithScores(String... keys)
Compute the difference between all the sets in the given keys.
|
double |
zincrby(String key,
double increment,
String member)
If member already exists in the sorted set adds the increment to its score and updates the
position of the element in the sorted set accordingly.
|
Double |
zincrby(String key,
double increment,
String member,
ZIncrByParams params)
Similar to
ZINCRBY but can be used with optionals params. |
Set<String> |
zinter(ZParams params,
String... keys)
Compute the intersection between all the sets in the given keys.
|
long |
zintercard(long limit,
String... keys)
Similar to
ZINTER , but
instead of returning the result set, it returns just the cardinality of the result. |
long |
zintercard(String... keys)
Similar to
ZINTER , but
instead of returning the result set, it returns just the cardinality of the result. |
long |
zinterstore(String dstkey,
String... sets)
Compute the intersection between all the sets in the given keys.
|
long |
zinterstore(String dstkey,
ZParams params,
String... sets)
Compute the intersection between all the sets in the given keys.
|
Set<Tuple> |
zinterWithScores(ZParams params,
String... keys)
Compute the intersection between all the sets in the given keys.
|
long |
zlexcount(String key,
String min,
String max)
Return the number of elements in the sorted set at key with a value between min and max, when all
the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering.
|
KeyValue<String,List<Tuple>> |
zmpop(SortedSetOption option,
int count,
String... keys) |
KeyValue<String,List<Tuple>> |
zmpop(SortedSetOption option,
String... keys) |
List<Double> |
zmscore(String key,
String... members)
Return the scores associated with the specified members in the sorted set stored at key.
|
Tuple |
zpopmax(String key)
Remove and return the member with the highest score in the sorted set stored at key.
|
List<Tuple> |
zpopmax(String key,
int count)
Remove and return up to count members with the highest scores in the sorted set stored at key.
|
Tuple |
zpopmin(String key)
Remove and return the member with the lowest score in the sorted set stored at key.
|
List<Tuple> |
zpopmin(String key,
int count)
Remove and return up to count members with the lowest scores in the sorted set stored at key.
|
String |
zrandmember(String key)
Return a random element from the sorted set value stored at key.
|
List<String> |
zrandmember(String key,
long count)
Return an array of distinct elements.
|
List<Tuple> |
zrandmemberWithScores(String key,
long count)
Similar to
ZRANDMEMBER but the replay will
include the scores with the result. |
List<String> |
zrange(String key,
long start,
long stop)
Returns the specified range of elements in the sorted set stored at key.
|
List<String> |
zrange(String key,
ZRangeParams zRangeParams)
Similar to
ZRANGE but can be used with additional params. |
List<String> |
zrangeByLex(String key,
String min,
String max)
Return all the elements in the sorted set at key with a value between min and max, when all
the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering.
|
List<String> |
zrangeByLex(String key,
String min,
String max,
int offset,
int count)
Similar to
ZRANGE but with limit option. |
List<String> |
zrangeByScore(String key,
double min,
double max)
Return all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
List<String> |
zrangeByScore(String key,
double min,
double max,
int offset,
int count)
Similar to
ZRANGE but with exclusive range. |
List<String> |
zrangeByScore(String key,
String min,
String max)
Similar to
ZRANGE but with exclusive range. |
List<String> |
zrangeByScore(String key,
String min,
String max,
int offset,
int count)
Similar to
ZRANGE but with limit option, |
List<Tuple> |
zrangeByScoreWithScores(String key,
double min,
double max)
Similar to
ZRANGE but return with scores. |
List<Tuple> |
zrangeByScoreWithScores(String key,
double min,
double max,
int offset,
int count)
Similar to
ZRANGE but with limit option,
and return with scores. |
List<Tuple> |
zrangeByScoreWithScores(String key,
String min,
String max)
Similar to
ZRANGE but with exclusive range,
and return with scores. |
List<Tuple> |
zrangeByScoreWithScores(String key,
String min,
String max,
int offset,
int count)
Similar to
ZRANGE but with exclusive range,
with limit options and return with scores. |
long |
zrangestore(String dest,
String src,
ZRangeParams zRangeParams)
Similar to
ZRANGE but stores the result in dest . |
List<Tuple> |
zrangeWithScores(String key,
long start,
long stop)
Returns the specified range of elements in the sorted set stored at key with the scores.
|
List<Tuple> |
zrangeWithScores(String key,
ZRangeParams zRangeParams)
Similar to
ZRANGE but can be used with additional params. |
Long |
zrank(String key,
String member)
Return the rank (or index) of member in the sorted set at key, with scores being ordered from
low to high.
|
long |
zrem(String key,
String... members)
Remove the specified member from the sorted set value stored at key.
|
long |
zremrangeByLex(String key,
String min,
String max)
Remove all elements in the sorted set stored at key between the lexicographical range specified by min and max,
when all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering.
|
long |
zremrangeByRank(String key,
long start,
long stop)
Remove all elements in the sorted set at key with rank between start and end.
|
long |
zremrangeByScore(String key,
double min,
double max)
Remove all the elements in the sorted set at key with a score between min and max (including
elements with score equal to min or max).
|
long |
zremrangeByScore(String key,
String min,
String max)
Similar to
ZREMRANGE but with limit option. |
List<String> |
zrevrange(String key,
long start,
long stop)
Returns the specified range of elements in the sorted set stored at key.
|
List<String> |
zrevrangeByLex(String key,
String max,
String min)
Return all the elements in the sorted set at key with a value between max and min, when all
the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering.
|
List<String> |
zrevrangeByLex(String key,
String max,
String min,
int offset,
int count)
Similar to
ZRANGE but with limit option. |
List<String> |
zrevrangeByScore(String key,
double max,
double min)
Return all the elements in the sorted set at key with a score between max and min
(including elements with score equal to max or min).
|
List<String> |
zrevrangeByScore(String key,
double max,
double min,
int offset,
int count)
Similar to
ZRANGE but with limit option, |
List<String> |
zrevrangeByScore(String key,
String max,
String min)
Similar to
ZREVRANGE but with exclusive range. |
List<String> |
zrevrangeByScore(String key,
String max,
String min,
int offset,
int count)
Similar to
ZREVRANGE but with limit option, |
List<Tuple> |
zrevrangeByScoreWithScores(String key,
double max,
double min)
Similar to
ZREVRANGE but return with scores. |
List<Tuple> |
zrevrangeByScoreWithScores(String key,
double max,
double min,
int offset,
int count)
Similar to
ZREVRANGE but with
limit options and return with scores. |
List<Tuple> |
zrevrangeByScoreWithScores(String key,
String max,
String min)
Similar to
ZREVRANGE but with exclusive range,
and return with scores. |
List<Tuple> |
zrevrangeByScoreWithScores(String key,
String max,
String min,
int offset,
int count)
Similar to
ZREVRANGE but with
exclusive range, with limit options and return with scores. |
List<Tuple> |
zrevrangeWithScores(String key,
long start,
long stop)
Similar to
ZREVRANGE but the reply will
include the scores of the returned elements. |
Long |
zrevrank(String key,
String member)
Return the rank (or index) of member in the sorted set at key, with scores being ordered from
high to low.
|
default ScanResult<Tuple> |
zscan(String key,
String cursor) |
ScanResult<Tuple> |
zscan(String key,
String cursor,
ScanParams params) |
Double |
zscore(String key,
String member)
Return the score of the specified element of the sorted set at key.
|
Set<String> |
zunion(ZParams params,
String... keys)
Compute the union between all the sets in the given keys.
|
long |
zunionstore(String dstkey,
String... sets)
Compute the union between all the sets in the given keys.
|
long |
zunionstore(String dstkey,
ZParams params,
String... sets)
Compute the union between all the sets in the given keys.
|
Set<Tuple> |
zunionWithScores(ZParams params,
String... keys)
Compute the union between all the sets in the given keys.
|
long zadd(String key, double score, String member)
The score value can be the string representation of a double precision floating point number.
Time complexity O(log(N)) with N being the number of elements in the sorted set
key
- score
- member
- long zadd(String key, double score, String member, ZAddParams params)
ZADD
but can be used with optional params.key
- score
- member
- params
- ZAddParams
zadd(String, double, String)
long zadd(String key, Map<String,Double> scoreMembers)
ZADD
but for multiple members.key
- scoreMembers
- zadd(String, double, String)
long zadd(String key, Map<String,Double> scoreMembers, ZAddParams params)
ZADD
but can be used with optional params,
and fits for multiple members.key
- scoreMembers
- params
- ZAddParams
zadd(String, double, String)
Double zaddIncr(String key, double score, String member, ZAddParams params)
The score value should be the string representation of a numeric value, and accepts double precision floating point numbers. It is possible to provide a negative value to decrement the score.
Time complexity O(log(N)) with N being the number of elements in the sorted set
key
- score
- member
- params
- ZAddParams
long zrem(String key, String... members)
Time complexity O(log(N)) with N being the number of elements in the sorted set
key
- members
- double zincrby(String key, double increment, String member)
The score value can be the string representation of a double precision floating point number. It's possible to provide a negative value to perform a decrement.
For an introduction to sorted sets check the Introduction to Redis data types page.
Time complexity O(log(N)) with N being the number of elements in the sorted set
key
- increment
- member
- Double zincrby(String key, double increment, String member, ZIncrByParams params)
ZINCRBY
but can be used with optionals params.key
- increment
- member
- params
- ZIncrByParams
zincrby(String, double, String)
Long zrank(String key, String member)
When the given member does not exist in the sorted set, the special value 'nil' is returned. The returned rank (or index) of the member is 0-based for both commands.
Time complexity O(log(N))
key
- member
- Long zrevrank(String key, String member)
When the given member does not exist in the sorted set, the special value 'nil' is returned. The returned rank (or index) of the member is 0-based for both commands.
Time complexity O(log(N))
key
- member
- List<String> zrange(String key, long start, long stop)
Time complexity O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.
key
- the key to querystart
- the minimum indexstop
- the maximum indexList<String> zrevrange(String key, long start, long stop)
Time complexity O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.
key
- the key to querystart
- the minimum indexstop
- the maximum indexList<Tuple> zrangeWithScores(String key, long start, long stop)
key
- the key to querystart
- the minimum indexstop
- the maximum indexList<Tuple> zrevrangeWithScores(String key, long start, long stop)
ZREVRANGE
but the reply will
include the scores of the returned elements.key
- the key to querystart
- the minimum indexstop
- the maximum indexzrevrange(String, long, long)
List<String> zrange(String key, ZRangeParams zRangeParams)
ZRANGE
but can be used with additional params.key
- the key to queryzRangeParams
- ZRangeParams
zrange(String, long, long)
List<Tuple> zrangeWithScores(String key, ZRangeParams zRangeParams)
ZRANGE
but can be used with additional params.key
- the key to queryzRangeParams
- ZRangeParams
zrangeWithScores(String, long, long)
long zrangestore(String dest, String src, ZRangeParams zRangeParams)
ZRANGE
but stores the result in dest
.dest
- the storing keysrc
- the key to queryzRangeParams
- ZRangeParams
zrange(String, ZRangeParams)
String zrandmember(String key)
Time complexity O(N) where N is the number of elements returned
key
- List<String> zrandmember(String key, long count)
ZCARD
), whichever is lower.
Time complexity O(N) where N is the number of elements returned
key
- count
- choose up to count elementsList<Tuple> zrandmemberWithScores(String key, long count)
ZRANDMEMBER
but the replay will
include the scores with the result.key
- count
- choose up to count elementszrandmember(String, long)
long zcard(String key)
Time complexity O(1)
key
- Double zscore(String key, String member)
Time complexity O(1)
key
- member
- List<Double> zmscore(String key, String... members)
Time complexity O(N) where N is the number of members being requested
key
- members
- Tuple zpopmax(String key)
Time complexity O(log(N)) with N being the number of elements in the sorted set
key
- List<Tuple> zpopmax(String key, int count)
Time complexity O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.
key
- count
- the number of elements to popTuple zpopmin(String key)
Time complexity O(log(N)) with N being the number of elements in the sorted set
key
- List<Tuple> zpopmin(String key, int count)
Time complexity O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.
key
- count
- the number of elements to poplong zcount(String key, double min, double max)
Time complexity O(log(N)) with N being the number of elements in the sorted set.
key
- the key to querymin
- minimum scoremax
- maximum scorelong zcount(String key, String min, String max)
ZCOUNT
but with exclusive range.zcount(String, double, double)
List<String> zrangeByScore(String key, double min, double max)
Time complexity O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned.
key
- the key to querymin
- minimum scoremax
- maximum scoreList<String> zrangeByScore(String key, String min, String max)
ZRANGE
but with exclusive range.zrangeByScore(String, double, double)
List<String> zrevrangeByScore(String key, double max, double min)
The elements having the same score are returned in reverse lexicographical order.
Time complexity O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned.
key
- the key to querymax
- maximum scoremin
- minimum scoreList<String> zrangeByScore(String key, double min, double max, int offset, int count)
ZRANGE
but with exclusive range.key
- the key to querymin
- minimum scoremax
- maximum scoreoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetzrangeByScore(String, double, double)
List<String> zrevrangeByScore(String key, String max, String min)
ZREVRANGE
but with exclusive range.zrevrangeByScore(String, double, double)
List<String> zrangeByScore(String key, String min, String max, int offset, int count)
ZRANGE
but with limit option,key
- the key to querymin
- minimum scoremax
- maximum scoreoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetand with exclusive range.
List<String> zrevrangeByScore(String key, double max, double min, int offset, int count)
ZRANGE
but with limit option,key
- the key to querymax
- maximum scoremin
- minimum scoreoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetzrevrangeByScore(String, double, double)
List<Tuple> zrangeByScoreWithScores(String key, double min, double max)
ZRANGE
but return with scores.key
- the key to querymin
- minimum scoremax
- maximum scorereturn both the element and its score, instead of the element alone.
List<Tuple> zrevrangeByScoreWithScores(String key, double max, double min)
ZREVRANGE
but return with scores.key
- the key to querymax
- maximum scoremin
- minimum scorereturn both the element and its score, instead of the element alone.
List<Tuple> zrangeByScoreWithScores(String key, double min, double max, int offset, int count)
ZRANGE
but with limit option,
and return with scores.key
- the key to querymin
- minimum scoremax
- maximum scoreoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetzrangeByScore(String, double, double)
List<String> zrevrangeByScore(String key, String max, String min, int offset, int count)
ZREVRANGE
but with limit option,key
- the key to querymax
- maximum scoremin
- minimum scoreoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetand with exclusive range.
List<Tuple> zrangeByScoreWithScores(String key, String min, String max)
ZRANGE
but with exclusive range,
and return with scores.zrangeByScore(String, double, double)
List<Tuple> zrevrangeByScoreWithScores(String key, String max, String min)
ZREVRANGE
but with exclusive range,
and return with scores.zrevrangeByScore(String, double, double)
List<Tuple> zrangeByScoreWithScores(String key, String min, String max, int offset, int count)
ZRANGE
but with exclusive range,
with limit options and return with scores.key
- the key to querymin
- minimum scoremax
- maximum scoreoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetzrangeByScore(String, String, String)
List<Tuple> zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count)
ZREVRANGE
but with
limit options and return with scores.key
- the key to querymax
- maximum scoremin
- minimum scoreoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetzrevrangeByScore(String, double, double)
List<Tuple> zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count)
ZREVRANGE
but with
exclusive range, with limit options and return with scores.key
- the key to querymax
- maximum scoremin
- minimum scoreoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetzrevrangeByScore(String, double, double)
long zremrangeByRank(String key, long start, long stop)
Time complexity O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
key
- start
- stop
- long zremrangeByScore(String key, double min, double max)
Time complexity O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
key
- min
- minimum score to removemax
- maximum score to removelong zremrangeByScore(String key, String min, String max)
ZREMRANGE
but with limit option.zremrangeByScore(String, double, double)
long zlexcount(String key, String min, String max)
Time complexity O(log(N)) with N being the number of elements in the sorted set.
key
- min
- minimum valuemax
- maximum valueList<String> zrangeByLex(String key, String min, String max)
Time complexity O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned.
key
- min
- minimum valuemax
- maximum valueList<String> zrangeByLex(String key, String min, String max, int offset, int count)
ZRANGE
but with limit option.key
- min
- minimum valuemax
- maximum valueoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetzrangeByLex(String, String, String)
List<String> zrevrangeByLex(String key, String max, String min)
Time complexity O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned.
key
- max
- maximum valuemin
- minimum valueList<String> zrevrangeByLex(String key, String max, String min, int offset, int count)
ZRANGE
but with limit option.key
- max
- maximum valuemin
- minimum valueoffset
- the first index of the sub-rangecount
- count of the sub-range. A negative count returns all elements from the offsetzrevrangeByLex(String, String, String)
long zremrangeByLex(String key, String min, String max)
Time complexity O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
key
- min
- minimum value to removemax
- maximum value to removedefault ScanResult<Tuple> zscan(String key, String cursor)
ScanResult<Tuple> zscan(String key, String cursor, ScanParams params)
KeyedZSetElement bzpopmax(double timeout, String... keys)
ZPOPMAX
timeout
- specifying the maximum number of seconds to block. A timeout of zero can
be used to block indefinitely.keys
- KeyedZSetElement bzpopmin(double timeout, String... keys)
ZPOPMIN
timeout
- specifying the maximum number of seconds to block. A timeout of zero can
be used to block indefinitely.keys
- Set<String> zdiff(String... keys)
Time complexity O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set.
keys
- group of setsSet<Tuple> zdiffWithScores(String... keys)
keys
- group of setslong zdiffStore(String dstkey, String... keys)
dstkey
- keys
- group of setsSet<String> zinter(ZParams params, String... keys)
Time complexity O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set.
params
- ZParams
keys
- group of setsSet<Tuple> zinterWithScores(ZParams params, String... keys)
params
- ZParams
keys
- group of setslong zinterstore(String dstkey, String... sets)
dstkey
- sets
- group of setslong zinterstore(String dstkey, ZParams params, String... sets)
dstkey
- params
- ZParams
sets
- group of setslong zintercard(String... keys)
ZINTER
, but
instead of returning the result set, it returns just the cardinality of the result.
Time complexity O(N*K) worst case with N being the smallest input sorted set, K being the number of input sorted sets
keys
- group of setszinter(ZParams, String...)
long zintercard(long limit, String... keys)
ZINTER
, but
instead of returning the result set, it returns just the cardinality of the result.
Time complexity O(N*K) worst case with N being the smallest input sorted set, K being the number of input sorted sets
limit
- If the intersection cardinality reaches limit partway through the computation,
the algorithm will exit and yield limit as the cardinalitykeys
- group of setszinter(ZParams, String...)
Set<String> zunion(ZParams params, String... keys)
Time complexity O(N)+O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set.
params
- ZParams
keys
- group of setsSet<Tuple> zunionWithScores(ZParams params, String... keys)
params
- ZParams
keys
- group of setslong zunionstore(String dstkey, String... sets)
dstkey
- sets
- group of setslong zunionstore(String dstkey, ZParams params, String... sets)
dstkey
- params
- ZParams
sets
- group of setsCopyright © 2022. All rights reserved.