Skip to content

Instantly share code, notes, and snippets.

@alphazero
Created October 11, 2009 20:43
Show Gist options
  • Save alphazero/207863 to your computer and use it in GitHub Desktop.
Save alphazero/207863 to your computer and use it in GitHub Desktop.
private void runJRedisPipeline(ConnectionSpec spec, int reqCnt) {
JRedisFuture pipeline = new JRedisPipeline(spec);
try {
String key = "pipeCounter";
Future<Boolean> futureBool = pipeline.del(key);
futureBool.get();
int cnt = 0;
Future<Long> futureLong = null;
while(cnt < reqCnt){
futureLong = pipeline.incr(key);
cnt++;
}
long counter = futureLong.get();
pipeline.quit();
}
catch (ProviderException e) {
e.printStackTrace();
}
catch (InterruptedException e) {
e.printStackTrace();
}
catch (ExecutionException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment