Redis 检查管道中的BRPOPLPUSH是否超时

Redis 检查管道中的BRPOPLPUSH是否超时,redis,Redis,我正在运行类似于BRPOPLPUSH open close 1的程序,然后在管道中运行expire close 10 echo "BRPOPLPUSH open close 1\nexpire close 10" | redis-cli -h redis --pipe 这是一种锁紧装置。我遇到的问题是,即使BRPOPLPUSH超时,我也会延长closelock的过期时间 是否有方法仅在BRPOPLPUSH成功时设置过期?当然,我可以在bash/python中实现这一点——

我正在运行类似于
BRPOPLPUSH open close 1
的程序,然后在管道中运行
expire close 10

echo "BRPOPLPUSH open close 1\nexpire close  10" | redis-cli -h redis --pipe
这是一种锁紧装置。我遇到的问题是,即使
BRPOPLPUSH
超时,我也会延长
close
lock的过期时间

是否有方法仅在
BRPOPLPUSH
成功时设置过期?当然,我可以在bash/python中实现这一点——检查是否返回null并设置expire。但是,我失去了通过redis管道获得的性能