简介:基于Netty框架的事件驱动的通信层,Redis 客户端,线程安全同步。异步调用。
lettuce 官网地址:https://lettuce.io/
lettuce git项目地址:https://github.com/lettuce-io/lettuce-core
使用:
1、在pom.xml 中加入依赖
2、 调用
import io.lettuce.core.*;
RedisClient redisClient = RedisClient.create("redis://password@localhost:6379/0");
StatefulRedisConnection<String, String> connection = redisClient.connect();
RedisCommands<String, String> syncCommands = connection.sync();
syncCommands.set("key", "Hello, Redis!");
connection.close();
redisClient.shutdown();