Skip to content

Commit

Permalink
Merge pull request #364 from thesmith/master
Browse files Browse the repository at this point in the history
Add 'del' to ShardedJedisPipeline
  • Loading branch information
xetorthio committed Nov 2, 2012
2 parents bdc517d + 909be71 commit 2058231
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/redis/clients/jedis/ShardedJedisPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ public Response<String> get(String key) {
return getResponse(BuilderFactory.STRING);
}

public Response<Long> del(String key) {
Client c = getClient(key);
c.del(key);
results.add(new FutureResult(c));
return getResponse(BuilderFactory.LONG);
}

public Response<Boolean> exists(String key) {
Client c = getClient(key);
c.exists(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public void pipelineResponse() {

ShardedJedisPipeline p = jedis.pipelined();
Response<String> string = p.get("string");
Response<Long> del = p.del("string");
Response<String> emptyString = p.get("string");
Response<String> list = p.lpop("list");
Response<String> hash = p.hget("hash", "foo");
Response<Set<String>> zset = p.zrange("zset", 0, -1);
Expand All @@ -91,6 +93,8 @@ public void pipelineResponse() {
p.sync();

assertEquals("foo", string.get());
assertEquals(Long.valueOf(1), del.get());
assertNull(emptyString.get());
assertEquals("foo", list.get());
assertEquals("bar", hash.get());
assertEquals("foo", zset.get().iterator().next());
Expand Down

0 comments on commit 2058231

Please sign in to comment.