import io.lettuce.core.RedisClient; import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.api.sync.RedisCommands; public class LettuceExample { public static void main(String[] args) { RedisClient redisClient = RedisClient.create("redis://localhost"); StatefulRedisConnection<String, String> connection = redisClient.connect(); RedisCommands<String, String> syncCommands = connection.sync(); syncCommands.set("key", "value"); String value = syncCommands.get("key"); System.out.println("Retrieved value: " + value); connection.close(); redisClient.shutdown(); } }


上一篇:
下一篇:
切换中文