import io.lettuce.core.RedisClient; import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.api.reactive.RedisReactiveCommands; public class RxRedisExample { public static void main(String[] args) { RedisClient client = RedisClient.create("redis://localhost"); StatefulRedisConnection<String, String> connection = client.connect(); RedisReactiveCommands<String, String> reactiveCommands = connection.reactive(); reactiveCommands.set("key", "value") .flatMap(result -> reactiveCommands.get("key")) .subscribe(value -> System.out.println("Value: " + value)); connection.close(); client.shutdown(); } }


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