lettuce---redis非同期通信
780 ワード
今日はlettuceを簡単に研究し,lettuceは主にnettyを利用してredisとの同期と非同期通信を実現した.
RedisConnection connection = client.connect();
connection.set("key","key");
String value = connection.get("key");
/*RedisAsyncConnection async = client.connectAsync();
Future set = async.set("key", "value");
Future get = async.get("key");
async.awaitAll(set, get);
try {
set.get();
get.get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
client.shutdown();