lettuce---redis异步通信

今天简单研究了下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();


 

你可能感兴趣的:(redis)