Merge pull request #364 from thesmith/master

Add 'del' to ShardedJedisPipeline
This commit is contained in:
Jonathan Leibiusky
2012-11-02 12:54:25 -07:00
2 changed files with 11 additions and 0 deletions

View File

@@ -39,6 +39,13 @@ public class ShardedJedisPipeline extends Queable {
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);

View File

@@ -74,6 +74,8 @@ public class ShardedJedisPipelineTest {
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);
@@ -91,6 +93,8 @@ public class ShardedJedisPipelineTest {
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());