Now methods accepting infinit and exclusions are supported as String and byte[] overloads
This commit is contained in:
@@ -527,18 +527,8 @@ public class BinaryClient extends Connection {
|
||||
sendCommand(PUNSUBSCRIBE, patterns);
|
||||
}
|
||||
|
||||
public void zcount(final byte[] key, final double min, final double max) {
|
||||
sendCommand(ZCOUNT, key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public void zrangeByScore(final byte[] key, final double min,
|
||||
final double max) {
|
||||
sendCommand(ZRANGEBYSCORE, key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public void zrevrangeByScore(final byte[] key, final double max,
|
||||
final double min) {
|
||||
sendCommand(ZREVRANGEBYSCORE, key, toByteArray(max), toByteArray(min));
|
||||
public void zcount(final byte[] key, final byte[] min, final byte[] max) {
|
||||
sendCommand(ZCOUNT, key, min, max);
|
||||
}
|
||||
|
||||
public void zrangeByScore(final byte[] key, final byte[] min,
|
||||
@@ -551,40 +541,40 @@ public class BinaryClient extends Connection {
|
||||
sendCommand(ZREVRANGEBYSCORE, key, max, min);
|
||||
}
|
||||
|
||||
public void zrangeByScore(final byte[] key, final double min,
|
||||
final double max, final int offset, int count) {
|
||||
sendCommand(ZRANGEBYSCORE, key, toByteArray(min), toByteArray(max),
|
||||
public void zrangeByScore(final byte[] key, final byte[] min,
|
||||
final byte[] max, final int offset, int count) {
|
||||
sendCommand(ZRANGEBYSCORE, key, min, max,
|
||||
LIMIT.raw, toByteArray(offset), toByteArray(count));
|
||||
}
|
||||
|
||||
public void zrevrangeByScore(final byte[] key, final double max,
|
||||
final double min, final int offset, int count) {
|
||||
sendCommand(ZREVRANGEBYSCORE, key, toByteArray(max), toByteArray(min),
|
||||
public void zrevrangeByScore(final byte[] key, final byte[] max,
|
||||
final byte[] min, final int offset, int count) {
|
||||
sendCommand(ZREVRANGEBYSCORE, key, max, min,
|
||||
LIMIT.raw, toByteArray(offset), toByteArray(count));
|
||||
}
|
||||
|
||||
public void zrangeByScoreWithScores(final byte[] key, final double min,
|
||||
final double max) {
|
||||
sendCommand(ZRANGEBYSCORE, key, toByteArray(min), toByteArray(max),
|
||||
public void zrangeByScoreWithScores(final byte[] key, final byte[] min,
|
||||
final byte[] max) {
|
||||
sendCommand(ZRANGEBYSCORE, key, min, max,
|
||||
WITHSCORES.raw);
|
||||
}
|
||||
|
||||
public void zrevrangeByScoreWithScores(final byte[] key, final double max,
|
||||
final double min) {
|
||||
sendCommand(ZREVRANGEBYSCORE, key, toByteArray(max), toByteArray(min),
|
||||
public void zrevrangeByScoreWithScores(final byte[] key, final byte[] max,
|
||||
final byte[] min) {
|
||||
sendCommand(ZREVRANGEBYSCORE, key, max, min,
|
||||
WITHSCORES.raw);
|
||||
}
|
||||
|
||||
public void zrangeByScoreWithScores(final byte[] key, final double min,
|
||||
final double max, final int offset, final int count) {
|
||||
sendCommand(ZRANGEBYSCORE, key, toByteArray(min), toByteArray(max),
|
||||
public void zrangeByScoreWithScores(final byte[] key, final byte[] min,
|
||||
final byte[] max, final int offset, final int count) {
|
||||
sendCommand(ZRANGEBYSCORE, key, min, max,
|
||||
LIMIT.raw, toByteArray(offset), toByteArray(count),
|
||||
WITHSCORES.raw);
|
||||
}
|
||||
|
||||
public void zrevrangeByScoreWithScores(final byte[] key, final double max,
|
||||
final double min, final int offset, final int count) {
|
||||
sendCommand(ZREVRANGEBYSCORE, key, toByteArray(max), toByteArray(min),
|
||||
public void zrevrangeByScoreWithScores(final byte[] key, final byte[] max,
|
||||
final byte[] min, final int offset, final int count) {
|
||||
sendCommand(ZREVRANGEBYSCORE, key, max, min,
|
||||
LIMIT.raw, toByteArray(offset), toByteArray(count),
|
||||
WITHSCORES.raw);
|
||||
}
|
||||
@@ -593,9 +583,9 @@ public class BinaryClient extends Connection {
|
||||
sendCommand(ZREMRANGEBYRANK, key, toByteArray(start), toByteArray(end));
|
||||
}
|
||||
|
||||
public void zremrangeByScore(final byte[] key, final double start,
|
||||
final double end) {
|
||||
sendCommand(ZREMRANGEBYSCORE, key, toByteArray(start), toByteArray(end));
|
||||
public void zremrangeByScore(final byte[] key, final byte[] start,
|
||||
final byte[] end) {
|
||||
sendCommand(ZREMRANGEBYSCORE, key, start, end);
|
||||
}
|
||||
|
||||
public void zunionstore(final byte[] dstkey, final byte[]... sets) {
|
||||
|
||||
@@ -2064,11 +2064,15 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
}
|
||||
|
||||
public Long zcount(final byte[] key, final double min, final double max) {
|
||||
checkIsInMulti();
|
||||
client.zcount(key, min, max);
|
||||
return client.getIntegerReply();
|
||||
return zcount(key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
|
||||
public Long zcount(final byte[] key, final byte[] min, final byte[] max) {
|
||||
checkIsInMulti();
|
||||
client.zcount(key, min, max);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the 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).
|
||||
@@ -2127,10 +2131,8 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
*/
|
||||
public Set<byte[]> zrangeByScore(final byte[] key, final double min,
|
||||
final double max) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScore(key, min, max);
|
||||
return new LinkedHashSet<byte[]>(client.getBinaryMultiBulkReply());
|
||||
}
|
||||
return zrangeByScore(key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public Set<byte[]> zrangeByScore(final byte[] key, final byte[] min,
|
||||
final byte[] max) {
|
||||
@@ -2197,10 +2199,15 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
*/
|
||||
public Set<byte[]> zrangeByScore(final byte[] key, final double min,
|
||||
final double max, final int offset, final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScore(key, min, max, offset, count);
|
||||
return new LinkedHashSet<byte[]>(client.getBinaryMultiBulkReply());
|
||||
return zrangeByScore(key, toByteArray(min),toByteArray(max),offset, count);
|
||||
}
|
||||
|
||||
public Set<byte[]> zrangeByScore(final byte[] key, final byte[] min,
|
||||
final byte[] max, final int offset, final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScore(key, min, max, offset, count);
|
||||
return new LinkedHashSet<byte[]>(client.getBinaryMultiBulkReply());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the all the elements in the sorted set at key with a score between
|
||||
@@ -2260,11 +2267,16 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
*/
|
||||
public Set<Tuple> zrangeByScoreWithScores(final byte[] key,
|
||||
final double min, final double max) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScoreWithScores(key, min, max);
|
||||
Set<Tuple> set = getBinaryTupledSet();
|
||||
return set;
|
||||
return zrangeByScoreWithScores(key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public Set<Tuple> zrangeByScoreWithScores(final byte[] key,
|
||||
final byte[] min, final byte[] max) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScoreWithScores(key, min, max);
|
||||
Set<Tuple> set = getBinaryTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the all the elements in the sorted set at key with a score between
|
||||
@@ -2325,11 +2337,17 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
public Set<Tuple> zrangeByScoreWithScores(final byte[] key,
|
||||
final double min, final double max, final int offset,
|
||||
final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||
Set<Tuple> set = getBinaryTupledSet();
|
||||
return set;
|
||||
return zrangeByScoreWithScores(key, toByteArray(min), toByteArray(max), offset, count);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrangeByScoreWithScores(final byte[] key,
|
||||
final byte[] min, final byte[] max, final int offset,
|
||||
final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||
Set<Tuple> set = getBinaryTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
private Set<Tuple> getBinaryTupledSet() {
|
||||
checkIsInMulti();
|
||||
@@ -2345,9 +2363,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
|
||||
public Set<byte[]> zrevrangeByScore(final byte[] key, final double max,
|
||||
final double min) {
|
||||
checkIsInMulti();
|
||||
client.zrevrangeByScore(key, max, min);
|
||||
return new LinkedHashSet<byte[]>(client.getBinaryMultiBulkReply());
|
||||
return zrevrangeByScore(key, toByteArray(max), toByteArray(min));
|
||||
}
|
||||
|
||||
public Set<byte[]> zrevrangeByScore(final byte[] key, final byte[] max,
|
||||
@@ -2359,13 +2375,29 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
|
||||
public Set<byte[]> zrevrangeByScore(final byte[] key, final double max,
|
||||
final double min, final int offset, final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrevrangeByScore(key, max, min, offset, count);
|
||||
return new LinkedHashSet<byte[]>(client.getBinaryMultiBulkReply());
|
||||
return zrevrangeByScore(key, toByteArray(max), toByteArray(min), offset, count);
|
||||
}
|
||||
|
||||
public Set<byte[]> zrevrangeByScore(final byte[] key, final byte[] max,
|
||||
final byte[] min, final int offset, final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrevrangeByScore(key, max, min, offset, count);
|
||||
return new LinkedHashSet<byte[]>(client.getBinaryMultiBulkReply());
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(final byte[] key,
|
||||
final double max, final double min) {
|
||||
return zrevrangeByScoreWithScores(key, toByteArray(max), toByteArray(min));
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(final byte[] key,
|
||||
final double max, final double min, final int offset,
|
||||
final int count) {
|
||||
return zrevrangeByScoreWithScores(key, toByteArray(max), toByteArray(min), offset, count);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(final byte[] key,
|
||||
final byte[] max, final byte[] min) {
|
||||
checkIsInMulti();
|
||||
client.zrevrangeByScoreWithScores(key, max, min);
|
||||
Set<Tuple> set = getBinaryTupledSet();
|
||||
@@ -2373,13 +2405,13 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(final byte[] key,
|
||||
final double max, final double min, final int offset,
|
||||
final byte[] max, final byte[] min, final int offset,
|
||||
final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
||||
Set<Tuple> set = getBinaryTupledSet();
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all elements in the sorted set at key with rank between start and
|
||||
@@ -2416,10 +2448,15 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
*/
|
||||
public Long zremrangeByScore(final byte[] key, final double start,
|
||||
final double end) {
|
||||
checkIsInMulti();
|
||||
client.zremrangeByScore(key, start, end);
|
||||
return client.getIntegerReply();
|
||||
return zremrangeByScore(key, toByteArray(start), toByteArray(end));
|
||||
}
|
||||
|
||||
public Long zremrangeByScore(final byte[] key, final byte[] start,
|
||||
final byte[] end) {
|
||||
checkIsInMulti();
|
||||
client.zremrangeByScore(key, start, end);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a union or intersection of N sorted sets given by keys k1 through
|
||||
|
||||
@@ -131,6 +131,8 @@ public interface BinaryJedisCommands {
|
||||
|
||||
Long zcount(byte[] key, double min, double max);
|
||||
|
||||
Long zcount(byte[] key, byte[] min, byte[] max);
|
||||
|
||||
Set<byte[]> zrangeByScore(byte[] key, double min, double max);
|
||||
|
||||
Set<byte[]> zrangeByScore(byte[] key, double min, double max, int offset,
|
||||
@@ -141,20 +143,37 @@ public interface BinaryJedisCommands {
|
||||
Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max,
|
||||
int offset, int count);
|
||||
|
||||
Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max);
|
||||
|
||||
Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max,
|
||||
int offset, int count);
|
||||
|
||||
Set<byte[]> zrevrangeByScore(byte[] key, double max, double min);
|
||||
|
||||
Set<byte[]> zrevrangeByScore(byte[] key, double max, double min,
|
||||
int offset, int count);
|
||||
|
||||
Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min);
|
||||
|
||||
Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min,
|
||||
int offset, int count);
|
||||
|
||||
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min);
|
||||
|
||||
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min,
|
||||
int offset, int count);
|
||||
|
||||
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min);
|
||||
|
||||
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min,
|
||||
int offset, int count);
|
||||
|
||||
Long zremrangeByRank(byte[] key, int start, int end);
|
||||
|
||||
Long zremrangeByScore(byte[] key, double start, double end);
|
||||
|
||||
Long zremrangeByScore(byte[] key, byte[] start, byte[] end);
|
||||
|
||||
Long linsert(byte[] key, LIST_POSITION where, byte[] pivot, byte[] value);
|
||||
|
||||
Long objectRefcount(byte[] key);
|
||||
|
||||
@@ -339,6 +339,11 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
Jedis j = getShard(key);
|
||||
return j.zcount(key, min, max);
|
||||
}
|
||||
|
||||
public Long zcount(byte[] key, byte[] min, byte[] max) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zcount(key, min, max);
|
||||
}
|
||||
|
||||
public Set<byte[]> zrangeByScore(byte[] key, double min, double max) {
|
||||
Jedis j = getShard(key);
|
||||
@@ -361,6 +366,18 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
Jedis j = getShard(key);
|
||||
return j.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||
}
|
||||
|
||||
|
||||
public Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrangeByScoreWithScores(key, min, max);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min,
|
||||
byte[] max, int offset, int count) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||
}
|
||||
|
||||
public Set<byte[]> zrevrangeByScore(byte[] key, double max, double min) {
|
||||
Jedis j = getShard(key);
|
||||
@@ -384,6 +401,29 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
||||
}
|
||||
|
||||
public Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScore(key, max, min);
|
||||
}
|
||||
|
||||
public Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min,
|
||||
int offset, int count) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScore(key, max, min, offset, count);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max,
|
||||
byte[] min) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScoreWithScores(key, max, min);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max,
|
||||
byte[] min, int offset, int count) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
||||
}
|
||||
|
||||
public Long zremrangeByRank(byte[] key, int start, int end) {
|
||||
Jedis j = getShard(key);
|
||||
@@ -395,6 +435,11 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
return j.zremrangeByScore(key, start, end);
|
||||
}
|
||||
|
||||
public Long zremrangeByScore(byte[] key, byte[] start, byte[] end) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zremrangeByScore(key, start, end);
|
||||
}
|
||||
|
||||
public Long linsert(byte[] key, LIST_POSITION where, byte[] pivot,
|
||||
byte[] value) {
|
||||
Jedis j = getShard(key);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
import static redis.clients.jedis.Protocol.toByteArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -446,6 +448,10 @@ public class BinaryTransaction extends Queable {
|
||||
}
|
||||
|
||||
public Response<Long> zcount(byte[] key, double min, double max) {
|
||||
return zcount(key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public Response<Long> zcount(byte[] key, byte[] min, byte[] max) {
|
||||
client.zcount(key, min, max);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
@@ -473,30 +479,44 @@ public class BinaryTransaction extends Queable {
|
||||
|
||||
public Response<Set<byte[]>> zrangeByScore(byte[] key, double min,
|
||||
double max) {
|
||||
return zrangeByScore(key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public Response<Set<byte[]>> zrangeByScore(byte[] key, byte[] min,
|
||||
byte[] max) {
|
||||
client.zrangeByScore(key, min, max);
|
||||
return getResponse(BuilderFactory.BYTE_ARRAY_ZSET);
|
||||
}
|
||||
|
||||
public Response<Set<byte[]>> zrangeByScore(byte[] key, byte[] min,
|
||||
byte[] max) {
|
||||
client.zrangeByScore(key, min, max);
|
||||
return getResponse(BuilderFactory.BYTE_ARRAY_ZSET);
|
||||
}
|
||||
|
||||
public Response<Set<byte[]>> zrangeByScore(byte[] key, double min,
|
||||
double max, int offset, int count) {
|
||||
byte[] max, int offset, int count) {
|
||||
client.zrangeByScore(key, min, max, offset, count);
|
||||
return getResponse(BuilderFactory.BYTE_ARRAY_ZSET);
|
||||
}
|
||||
|
||||
public Response<Set<byte[]>> zrangeByScore(byte[] key, double min,
|
||||
double max, int offset, int count) {
|
||||
return zrangeByScore(key, toByteArray(min), toByteArray(max), offset, count);
|
||||
}
|
||||
|
||||
public Response<Set<Tuple>> zrangeByScoreWithScores(byte[] key, double min,
|
||||
double max) {
|
||||
client.zrangeByScoreWithScores(key, min, max);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET_BINARY);
|
||||
return zrangeByScoreWithScores(key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public Response<Set<Tuple>> zrangeByScoreWithScores(byte[] key, double min,
|
||||
double max, int offset, int count) {
|
||||
return zrangeByScoreWithScores(key, toByteArray(min), toByteArray(max), offset, count);
|
||||
}
|
||||
|
||||
public Response<Set<Tuple>> zrangeByScoreWithScores(byte[] key, byte[] min,
|
||||
byte[] max) {
|
||||
client.zrangeByScoreWithScores(key, min, max);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET_BINARY);
|
||||
}
|
||||
|
||||
public Response<Set<Tuple>> zrangeByScoreWithScores(byte[] key, byte[] min,
|
||||
byte[] max, int offset, int count) {
|
||||
client.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET_BINARY);
|
||||
}
|
||||
@@ -522,6 +542,10 @@ public class BinaryTransaction extends Queable {
|
||||
}
|
||||
|
||||
public Response<Long> zremrangeByScore(byte[] key, double start, double end) {
|
||||
return zremrangeByScore(key, toByteArray(start), toByteArray(end));
|
||||
}
|
||||
|
||||
public Response<Long> zremrangeByScore(byte[] key, byte[] start, byte[] end) {
|
||||
client.zremrangeByScore(key, start, end);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
@@ -405,12 +405,16 @@ public class Client extends BinaryClient implements Commands {
|
||||
}
|
||||
|
||||
public void zcount(final String key, final double min, final double max) {
|
||||
zcount(SafeEncoder.encode(key), min, max);
|
||||
zcount(SafeEncoder.encode(key), toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public void zcount(final String key, final String min, final String max) {
|
||||
zcount(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max));
|
||||
}
|
||||
|
||||
public void zrangeByScore(final String key, final double min,
|
||||
final double max) {
|
||||
zrangeByScore(SafeEncoder.encode(key), min, max);
|
||||
zrangeByScore(SafeEncoder.encode(key), toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public void zrangeByScore(final String key, final String min,
|
||||
@@ -421,23 +425,39 @@ public class Client extends BinaryClient implements Commands {
|
||||
|
||||
public void zrangeByScore(final String key, final double min,
|
||||
final double max, final int offset, int count) {
|
||||
zrangeByScore(SafeEncoder.encode(key), min, max, offset, count);
|
||||
zrangeByScore(SafeEncoder.encode(key), toByteArray(min), toByteArray(max), offset, count);
|
||||
}
|
||||
|
||||
public void zrangeByScoreWithScores(final String key, final double min,
|
||||
final double max) {
|
||||
zrangeByScoreWithScores(SafeEncoder.encode(key), min, max);
|
||||
zrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public void zrangeByScoreWithScores(final String key, final double min,
|
||||
final double max, final int offset, final int count) {
|
||||
zrangeByScoreWithScores(SafeEncoder.encode(key), min, max, offset,
|
||||
zrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(min), toByteArray(max), offset,
|
||||
count);
|
||||
}
|
||||
|
||||
public void zrevrangeByScore(final String key, final double max,
|
||||
final double min) {
|
||||
zrevrangeByScore(SafeEncoder.encode(key), max, min);
|
||||
zrevrangeByScore(SafeEncoder.encode(key), toByteArray(max), toByteArray(min));
|
||||
}
|
||||
|
||||
public void zrangeByScore(final String key, final String min,
|
||||
final String max, final int offset, int count) {
|
||||
zrangeByScore(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max), offset, count);
|
||||
}
|
||||
|
||||
public void zrangeByScoreWithScores(final String key, final String min,
|
||||
final String max) {
|
||||
zrangeByScoreWithScores(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max));
|
||||
}
|
||||
|
||||
public void zrangeByScoreWithScores(final String key, final String min,
|
||||
final String max, final int offset, final int count) {
|
||||
zrangeByScoreWithScores(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max), offset,
|
||||
count);
|
||||
}
|
||||
|
||||
public void zrevrangeByScore(final String key, final String max,
|
||||
@@ -448,19 +468,35 @@ public class Client extends BinaryClient implements Commands {
|
||||
|
||||
public void zrevrangeByScore(final String key, final double max,
|
||||
final double min, final int offset, int count) {
|
||||
zrevrangeByScore(SafeEncoder.encode(key), max, min, offset, count);
|
||||
zrevrangeByScore(SafeEncoder.encode(key), toByteArray(max), toByteArray(min), offset, count);
|
||||
}
|
||||
|
||||
public void zrevrangeByScore(final String key, final String max,
|
||||
final String min, final int offset, int count) {
|
||||
zrevrangeByScore(SafeEncoder.encode(key), SafeEncoder.encode(max), SafeEncoder.encode(min), offset, count);
|
||||
}
|
||||
|
||||
public void zrevrangeByScoreWithScores(final String key, final double max,
|
||||
final double min) {
|
||||
zrevrangeByScoreWithScores(SafeEncoder.encode(key), max, min);
|
||||
zrevrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(max), toByteArray(min));
|
||||
}
|
||||
|
||||
public void zrevrangeByScoreWithScores(final String key, final String max,
|
||||
final String min) {
|
||||
zrevrangeByScoreWithScores(SafeEncoder.encode(key), SafeEncoder.encode(max), SafeEncoder.encode(min));
|
||||
}
|
||||
|
||||
public void zrevrangeByScoreWithScores(final String key, final double max,
|
||||
final double min, final int offset, final int count) {
|
||||
zrevrangeByScoreWithScores(SafeEncoder.encode(key), max, min, offset,
|
||||
zrevrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(max), toByteArray(min), offset,
|
||||
count);
|
||||
}
|
||||
|
||||
public void zrevrangeByScoreWithScores(final String key, final String max,
|
||||
final String min, final int offset, final int count) {
|
||||
zrevrangeByScoreWithScores(SafeEncoder.encode(key), SafeEncoder.encode(max), SafeEncoder.encode(min), offset,
|
||||
count);
|
||||
}
|
||||
|
||||
public void zremrangeByRank(final String key, final int start, final int end) {
|
||||
zremrangeByRank(SafeEncoder.encode(key), start, end);
|
||||
@@ -468,8 +504,13 @@ public class Client extends BinaryClient implements Commands {
|
||||
|
||||
public void zremrangeByScore(final String key, final double start,
|
||||
final double end) {
|
||||
zremrangeByScore(SafeEncoder.encode(key), start, end);
|
||||
zremrangeByScore(SafeEncoder.encode(key), toByteArray(start), toByteArray(end));
|
||||
}
|
||||
|
||||
public void zremrangeByScore(final String key, final String start,
|
||||
final String end) {
|
||||
zremrangeByScore(SafeEncoder.encode(key), SafeEncoder.encode(start), SafeEncoder.encode(end));
|
||||
}
|
||||
|
||||
public void zunionstore(final String dstkey, final String... sets) {
|
||||
final byte[][] bsets = new byte[sets.length][];
|
||||
|
||||
@@ -183,6 +183,8 @@ public interface Commands {
|
||||
final int timeout);
|
||||
|
||||
public void zcount(final String key, final double min, final double max);
|
||||
|
||||
public void zcount(final String key, final String min, final String max);
|
||||
|
||||
public void zrangeByScore(final String key, final double min,
|
||||
final double max);
|
||||
@@ -199,7 +201,13 @@ public interface Commands {
|
||||
public void zrangeByScoreWithScores(final String key, final double min,
|
||||
final double max, final int offset, final int count);
|
||||
|
||||
public void zrevrangeByScore(final String key, final double max,
|
||||
public void zrangeByScoreWithScores(final String key, final String min,
|
||||
final String max);
|
||||
|
||||
public void zrangeByScoreWithScores(final String key, final String min,
|
||||
final String max, final int offset, final int count);
|
||||
|
||||
public void zrevrangeByScore(final String key, final double max,
|
||||
final double min);
|
||||
|
||||
public void zrevrangeByScore(final String key, final String max,
|
||||
@@ -213,12 +221,21 @@ public interface Commands {
|
||||
|
||||
public void zrevrangeByScoreWithScores(final String key, final double max,
|
||||
final double min, final int offset, final int count);
|
||||
|
||||
public void zrevrangeByScoreWithScores(final String key, final String max,
|
||||
final String min);
|
||||
|
||||
public void zrevrangeByScoreWithScores(final String key, final String max,
|
||||
final String min, final int offset, final int count);
|
||||
|
||||
public void zremrangeByRank(final String key, final int start, final int end);
|
||||
|
||||
public void zremrangeByScore(final String key, final double start,
|
||||
final double end);
|
||||
|
||||
public void zremrangeByScore(final String key, final String start,
|
||||
final String end);
|
||||
|
||||
public void zunionstore(final String dstkey, final String... sets);
|
||||
|
||||
public void zunionstore(final String dstkey, final ZParams params,
|
||||
|
||||
@@ -1991,6 +1991,12 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
client.zcount(key, min, max);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Long zcount(final String key, final String min, final String max) {
|
||||
checkIsInMulti();
|
||||
client.zcount(key, min, max);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the all the elements in the sorted set at key with a score between
|
||||
@@ -2125,6 +2131,13 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
client.zrangeByScore(key, min, max, offset, count);
|
||||
return new LinkedHashSet<String>(client.getMultiBulkReply());
|
||||
}
|
||||
|
||||
public Set<String> zrangeByScore(final String key, final String min,
|
||||
final String max, final int offset, final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScore(key, min, max, offset, count);
|
||||
return new LinkedHashSet<String>(client.getMultiBulkReply());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the all the elements in the sorted set at key with a score between
|
||||
@@ -2189,6 +2202,14 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
Set<Tuple> set = getTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
public Set<Tuple> zrangeByScoreWithScores(final String key,
|
||||
final String min, final String max) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScoreWithScores(key, min, max);
|
||||
Set<Tuple> set = getTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the all the elements in the sorted set at key with a score between
|
||||
@@ -2254,6 +2275,15 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
Set<Tuple> set = getTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
public Set<Tuple> zrangeByScoreWithScores(final String key,
|
||||
final String min, final String max, final int offset,
|
||||
final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||
Set<Tuple> set = getTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
private Set<Tuple> getTupledSet() {
|
||||
checkIsInMulti();
|
||||
@@ -2303,6 +2333,30 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
Set<Tuple> set = getTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(final String key,
|
||||
final String max, final String min, final int offset,
|
||||
final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
||||
Set<Tuple> set = getTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
public Set<String> zrevrangeByScore(final String key, final String max,
|
||||
final String min, final int offset, final int count) {
|
||||
checkIsInMulti();
|
||||
client.zrevrangeByScore(key, max, min, offset, count);
|
||||
return new LinkedHashSet<String>(client.getMultiBulkReply());
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(final String key,
|
||||
final String max, final String min) {
|
||||
checkIsInMulti();
|
||||
client.zrevrangeByScoreWithScores(key, max, min);
|
||||
Set<Tuple> set = getTupledSet();
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all elements in the sorted set at key with rank between start and
|
||||
@@ -2343,6 +2397,13 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
client.zremrangeByScore(key, start, end);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Long zremrangeByScore(final String key, final String start,
|
||||
final String end) {
|
||||
checkIsInMulti();
|
||||
client.zremrangeByScore(key, start, end);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a union or intersection of N sorted sets given by keys k1 through
|
||||
|
||||
@@ -136,13 +136,22 @@ public interface JedisCommands {
|
||||
|
||||
Long zcount(String key, double min, double max);
|
||||
|
||||
Long zcount(String key, String min, String max);
|
||||
|
||||
Set<String> zrangeByScore(String key, double min, double max);
|
||||
|
||||
Set<String> zrangeByScore(String key, String min, String max);
|
||||
|
||||
Set<String> zrevrangeByScore(String key, double max, double min);
|
||||
|
||||
Set<String> zrangeByScore(String key, double min, double max, int offset,
|
||||
int count);
|
||||
|
||||
Set<String> zrevrangeByScore(String key, String max, String min);
|
||||
|
||||
Set<String> zrangeByScore(String key, String min, String max, int offset,
|
||||
int count);
|
||||
|
||||
Set<String> zrevrangeByScore(String key, double max, double min,
|
||||
int offset, int count);
|
||||
|
||||
@@ -152,13 +161,28 @@ public interface JedisCommands {
|
||||
|
||||
Set<Tuple> zrangeByScoreWithScores(String key, double min, double max,
|
||||
int offset, int count);
|
||||
|
||||
Set<String> zrevrangeByScore(String key, String max, String min,
|
||||
int offset, int count);
|
||||
|
||||
Set<Tuple> zrangeByScoreWithScores(String key, String min, String max);
|
||||
|
||||
Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min);
|
||||
|
||||
Set<Tuple> zrangeByScoreWithScores(String key, String min, String max,
|
||||
int offset, int count);
|
||||
|
||||
Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min,
|
||||
int offset, int count);
|
||||
|
||||
Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min,
|
||||
int offset, int count);
|
||||
|
||||
Long zremrangeByRank(String key, int start, int end);
|
||||
|
||||
Long zremrangeByScore(String key, double start, double end);
|
||||
|
||||
Long zremrangeByScore(String key, String start, String end);
|
||||
|
||||
Long linsert(String key, Client.LIST_POSITION where, String pivot,
|
||||
String value);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
import static redis.clients.jedis.Protocol.toByteArray;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -842,7 +843,7 @@ public class Pipeline extends Queable {
|
||||
}
|
||||
|
||||
public Response<Long> zcount(byte[] key, double min, double max) {
|
||||
client.zcount(key, min, max);
|
||||
client.zcount(key, toByteArray(min), toByteArray(max));
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
@@ -896,10 +897,9 @@ public class Pipeline extends Queable {
|
||||
|
||||
public Response<Set<String>> zrangeByScore(byte[] key, double min,
|
||||
double max) {
|
||||
client.zrangeByScore(key, min, max);
|
||||
return getResponse(BuilderFactory.STRING_ZSET);
|
||||
return zrangeByScore(key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
|
||||
public Response<Set<String>> zrangeByScore(String key, String min,
|
||||
String max) {
|
||||
client.zrangeByScore(key, min, max);
|
||||
@@ -920,6 +920,11 @@ public class Pipeline extends Queable {
|
||||
|
||||
public Response<Set<String>> zrangeByScore(byte[] key, double min,
|
||||
double max, int offset, int count) {
|
||||
return zrangeByScore(key, toByteArray(min), toByteArray(max), offset, count);
|
||||
}
|
||||
|
||||
public Response<Set<String>> zrangeByScore(byte[] key, byte[] min,
|
||||
byte[] max, int offset, int count) {
|
||||
client.zrangeByScore(key, min, max, offset, count);
|
||||
return getResponse(BuilderFactory.STRING_ZSET);
|
||||
}
|
||||
@@ -932,6 +937,11 @@ public class Pipeline extends Queable {
|
||||
|
||||
public Response<Set<Tuple>> zrangeByScoreWithScores(byte[] key, double min,
|
||||
double max) {
|
||||
return zrangeByScoreWithScores(key, toByteArray(min), toByteArray(max));
|
||||
}
|
||||
|
||||
public Response<Set<Tuple>> zrangeByScoreWithScores(byte[] key, byte[] min,
|
||||
byte[] max) {
|
||||
client.zrangeByScoreWithScores(key, min, max);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET);
|
||||
}
|
||||
@@ -944,6 +954,12 @@ public class Pipeline extends Queable {
|
||||
|
||||
public Response<Set<Tuple>> zrangeByScoreWithScores(byte[] key, double min,
|
||||
double max, int offset, int count) {
|
||||
client.zrangeByScoreWithScores(key, toByteArray(min), toByteArray(max), offset, count);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET);
|
||||
}
|
||||
|
||||
public Response<Set<Tuple>> zrangeByScoreWithScores(byte[] key, byte[] min,
|
||||
byte[] max, int offset, int count) {
|
||||
client.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET);
|
||||
}
|
||||
@@ -956,7 +972,7 @@ public class Pipeline extends Queable {
|
||||
|
||||
public Response<Set<String>> zrevrangeByScore(byte[] key, double max,
|
||||
double min) {
|
||||
client.zrevrangeByScore(key, max, min);
|
||||
client.zrevrangeByScore(key, toByteArray(max), toByteArray(min));
|
||||
return getResponse(BuilderFactory.STRING_ZSET);
|
||||
}
|
||||
|
||||
@@ -980,6 +996,12 @@ public class Pipeline extends Queable {
|
||||
|
||||
public Response<Set<String>> zrevrangeByScore(byte[] key, double max,
|
||||
double min, int offset, int count) {
|
||||
client.zrevrangeByScore(key, toByteArray(max), toByteArray(min), offset, count);
|
||||
return getResponse(BuilderFactory.STRING_ZSET);
|
||||
}
|
||||
|
||||
public Response<Set<String>> zrevrangeByScore(byte[] key, byte[] max,
|
||||
byte[] min, int offset, int count) {
|
||||
client.zrevrangeByScore(key, max, min, offset, count);
|
||||
return getResponse(BuilderFactory.STRING_ZSET);
|
||||
}
|
||||
@@ -992,6 +1014,12 @@ public class Pipeline extends Queable {
|
||||
|
||||
public Response<Set<Tuple>> zrevrangeByScoreWithScores(byte[] key,
|
||||
double max, double min) {
|
||||
client.zrevrangeByScoreWithScores(key, toByteArray(max), toByteArray(min));
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET);
|
||||
}
|
||||
|
||||
public Response<Set<Tuple>> zrevrangeByScoreWithScores(byte[] key,
|
||||
byte[] max, byte[] min) {
|
||||
client.zrevrangeByScoreWithScores(key, max, min);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET);
|
||||
}
|
||||
@@ -1004,6 +1032,12 @@ public class Pipeline extends Queable {
|
||||
|
||||
public Response<Set<Tuple>> zrevrangeByScoreWithScores(byte[] key,
|
||||
double max, double min, int offset, int count) {
|
||||
client.zrevrangeByScoreWithScores(key, toByteArray(max), toByteArray(min), offset, count);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET);
|
||||
}
|
||||
|
||||
public Response<Set<Tuple>> zrevrangeByScoreWithScores(byte[] key,
|
||||
byte[] max, byte[] min, int offset, int count) {
|
||||
client.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
||||
return getResponse(BuilderFactory.TUPLE_ZSET);
|
||||
}
|
||||
@@ -1054,6 +1088,11 @@ public class Pipeline extends Queable {
|
||||
}
|
||||
|
||||
public Response<Long> zremrangeByScore(byte[] key, double start, double end) {
|
||||
client.zremrangeByScore(key, toByteArray(start), toByteArray(end));
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> zremrangeByScore(byte[] key, byte[] start, byte[] end) {
|
||||
client.zremrangeByScore(key, start, end);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
@@ -357,6 +357,11 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
Jedis j = getShard(key);
|
||||
return j.zcount(key, min, max);
|
||||
}
|
||||
|
||||
public Long zcount(String key, String min, String max) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zcount(key, min, max);
|
||||
}
|
||||
|
||||
public Set<String> zrangeByScore(String key, double min, double max) {
|
||||
Jedis j = getShard(key);
|
||||
@@ -402,6 +407,51 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
||||
}
|
||||
|
||||
public Set<String> zrangeByScore(String key, String min, String max) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrangeByScore(key, min, max);
|
||||
}
|
||||
|
||||
public Set<String> zrevrangeByScore(String key, String max, String min) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScore(key, max, min);
|
||||
}
|
||||
|
||||
public Set<String> zrangeByScore(String key, String min, String max,
|
||||
int offset, int count) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrangeByScore(key, min, max, offset, count);
|
||||
}
|
||||
|
||||
public Set<String> zrevrangeByScore(String key, String max, String min,
|
||||
int offset, int count) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScore(key, max, min, offset, count);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrangeByScoreWithScores(String key, String min, String max) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrangeByScoreWithScores(key, min, max);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(String key, String max,
|
||||
String min) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScoreWithScores(key, max, min);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrangeByScoreWithScores(String key, String min,
|
||||
String max, int offset, int count) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||
}
|
||||
|
||||
public Set<Tuple> zrevrangeByScoreWithScores(String key, String max,
|
||||
String min, int offset, int count) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
||||
}
|
||||
|
||||
public Long zremrangeByRank(String key, int start, int end) {
|
||||
Jedis j = getShard(key);
|
||||
@@ -412,6 +462,11 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
Jedis j = getShard(key);
|
||||
return j.zremrangeByScore(key, start, end);
|
||||
}
|
||||
|
||||
public Long zremrangeByScore(String key, String start, String end) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zremrangeByScore(key, start, end);
|
||||
}
|
||||
|
||||
public Long linsert(String key, LIST_POSITION where, String pivot,
|
||||
String value) {
|
||||
|
||||
Reference in New Issue
Block a user