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