Implemented Client.getMany(int count) to remove multiple flush while getting responses at once

This commit is contained in:
Jungtaek Lim
2014-01-20 11:36:24 +09:00
parent 5bf29b43ee
commit 2267c3318c
3 changed files with 24 additions and 34 deletions

View File

@@ -211,4 +211,17 @@ public class Connection {
flush();
return Protocol.read(inputStream);
}
public List<Object> getMany(int count) {
flush();
List<Object> responses = new ArrayList<Object>();
for (int i = 0 ; i < count ; i++) {
try {
responses.add(Protocol.read(inputStream));
} catch (JedisDataException e) {
responses.add(e);
}
}
return responses;
}
}