管道Redis命令

管道Redis命令,redis,reactive-programming,project-reactor,spring-data-redis,lettuce,Redis,Reactive Programming,Project Reactor,Spring Data Redis,Lettuce,我正在使用springbootwebflux+projectreactor+莴苣以非阻塞方式连接和查询Redis。 我已将reactivedistemplate配置为LettuceConnectionFactory。spring文档指出,将管道与reactivedistemplate一起使用的唯一方法是使用execute()方法。在非反应性的RedisTemplate中,我看到有一个executepelined()方法,它在执行回调之前打开/关闭管道。但是在reactivedistemplate

我正在使用
springbootwebflux
+
projectreactor
+
莴苣
以非阻塞方式连接和查询Redis。 我已将
reactivedistemplate
配置为
LettuceConnectionFactory
。spring文档指出,将管道与
reactivedistemplate
一起使用的唯一方法是使用
execute()
方法。在非反应性的
RedisTemplate
中,我看到有一个
executepelined()
方法,它在执行回调之前打开/关闭管道。但是在
reactivedistemplate.execute
方法的情况下,它使用
LettuceReactiveRedisConnection
,并且
Spring reactivedisconnection
莴苣
都没有对管道的引用

所以我的问题是,在使用
Spring reactiveedistemplate
+
ReactiveLettuceConnection
时,是否可以对命令进行pipleline操作

我还注意到,使用带有多个Redis命令的
RedisCallback
reactiveedistemplate.execute
比单独调用命令执行得慢

带有ReactiveEdisTemplate的pipleline示例代码:

reactiveRedisTemplate.execute(connection -> keys.flatMap(key -> 
                                connection.hashCommands()
                                .hGetAll(ByteBuffer.wrap(key.getBytes()))))
                    .map(Map.Entry::getValue)
                    .map(ByteUtils::getBytes)
                    .map(b -> {
                        try {
                        return mapper.readValue(b, Value.class);
                        } catch (IOException e1) {
                        return null;
                        }
                    })
                    .collectList();
没有管道的代码:

keys.flatMap(key -> reactiveRedisTemplate.opsForHash().entries(key))
            .map(Map.Entry::getValue)
            .cast(Value.class)
            .collectList();

谢谢

我也遇到了同样的问题,已经在谷歌上搜索了一周都没有结果,你有什么解决办法吗?