use of com.generallycloud.baseio.codec.redis.future.RedisClient in project baseio by generallycloud.
the class TestRedisClient method main.
public static void main(String[] args) throws Exception {
SocketChannelContext context = new NioSocketChannelContext(new ServerConfiguration(6379));
SocketChannelConnector connector = new SocketChannelConnector(context);
context.setIoEventHandleAdaptor(new RedisIOEventHandle());
context.addSessionEventListener(new LoggerSocketSEListener());
context.setProtocolFactory(new RedisProtocolFactory());
SocketSession session = connector.connect();
RedisClient client = new RedisClient(session);
String value = client.set("name222", "hello redis!");
System.out.println("__________________res______" + value);
value = client.get("name222");
System.out.println("__________________res______" + value);
value = client.set("debug", "PONG");
System.out.println("__________________res______" + value);
value = client.get("debug");
System.out.println("__________________res______" + value);
value = client.ping();
System.out.println("__________________res______" + value);
ThreadUtil.sleep(100);
CloseUtil.close(connector);
}
Aggregations