Future - get, getSome
get
V get()
V get(long timeout, TimeUnit unit)getSome
V getSome(long timeout, TimeUnit unit)List<String> keyList = new ArrayList<String>();
for(int i = 1; i < 300; i++) {
client.set("key" + i, 5 * 60, "value");
keyList.add("key"+i);
}
Map<String, Object> map = null;
BulkFuture<Map<String, Object>> future = client.asyncGetBulk(keyList);
try {
map = future.get(6, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
}
System.out.println(map);
Map<String, Object> map2 = null;
BulkFuture<Map<String, Object>> future2 = client.asyncGetBulk(keyList);
try {
map2 = future2.getSome(6, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
e.printStackTrace();
}
System.out.println(map2);Last updated