LettuceRedis 的 Java 客戶端開發(fā)包
Lettuce是一個可伸縮線程安全的Redis客戶端。多個線程可以共享同一個RedisConnection。它利用優(yōu)秀netty NIO框架來高效地管理多個連接。
示例代碼:
RedisClient client = new RedisClient("localhost")
RedisConnection<String, String> connection = client.connect()
String value = connection.get("key")
異步 API
StatefulRedisConnection<String, String> connection = client.connect();
RedisStringAsyncCommands<String, String> async = connection.async();
RedisFuture<String> set = async.set("key", "value")
RedisFuture<String> get = async.get("key")
async.awaitAll(set, get) == true
set.get() == "OK"
get.get() == "value"評論
圖片
表情
