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