Implemented ZREMRANGEBYSCORE
This commit is contained in:
@@ -10,7 +10,7 @@ Jedis is a WORK IN PROGRESS.
|
||||
- Sharding
|
||||
- Persistence control commands
|
||||
- Remote server control commands
|
||||
- The ZREMRANGEBYSCORE, ZUNIONSTORE, ZINTERSTORE commands
|
||||
- The ZUNIONSTORE, ZINTERSTORE commands
|
||||
|
||||
But stay close because things are going fast and all this will be implemented soon!
|
||||
|
||||
@@ -22,7 +22,7 @@ But stay close because things are going fast and all this will be implemented so
|
||||
- Commands operating on hashes
|
||||
- Commands operating on lists
|
||||
- Commands operating on sets
|
||||
- Commands operating on sorted sets (not ZREMRANGEBYSCORE, ZUNIONSTORE, ZINTERSTORE)
|
||||
- Commands operating on sorted sets (not ZUNIONSTORE, ZINTERSTORE)
|
||||
- Transactions
|
||||
- Pipelining
|
||||
- Publish/Subscribe
|
||||
|
||||
@@ -468,4 +468,9 @@ public class Client extends Connection {
|
||||
sendCommand("ZREMRANGEBYRANK", key, String.valueOf(start), String
|
||||
.valueOf(end));
|
||||
}
|
||||
|
||||
public void zremrangeByScore(String key, int start, int end) {
|
||||
sendCommand("ZREMRANGEBYSCORE", key, String.valueOf(start), String
|
||||
.valueOf(end));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,4 +577,9 @@ public class Jedis {
|
||||
client.zremrangeByRank(key, start, end);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public int zremrangeByScore(String key, int start, int end) {
|
||||
client.zremrangeByScore(key, start, end);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
}
|
||||
@@ -270,4 +270,21 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
|
||||
assertEquals(expected, jedis.zrange("foo", 0, 100));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void zremrangeByScore() {
|
||||
jedis.zadd("foo", 1d, "a");
|
||||
jedis.zadd("foo", 10d, "b");
|
||||
jedis.zadd("foo", 0.1d, "c");
|
||||
jedis.zadd("foo", 2d, "a");
|
||||
|
||||
int result = jedis.zremrangeByScore("foo", 0, 2);
|
||||
|
||||
assertEquals(2, result);
|
||||
|
||||
Set<String> expected = new LinkedHashSet<String>();
|
||||
expected.add("b");
|
||||
|
||||
assertEquals(expected, jedis.zrange("foo", 0, 100));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user