labs-redisRedis 客户端开发包
labs-redis 是一个使用 Netty 开发的 Redis 客户端开发包。
示例代码:
RedisClient client = new RedisClient("127.0.0.1", 6379); // set a value and wait for server response // set() returns a ResponseFuture client.set("mykey", "myvalue").block(); // the future allows client to control timeouts Object value = client. get("mykey"). withTimeout(1, TimeUnit.SECONDS); System.out.println("mykey = " + value); // and response type demarshalling and conversions String value2 = client.get("mykey").asString(); System.out.println("mykey = " + value2);
评论