Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
可以在python中查看多个Redis键吗?_Python_Redis - Fatal编程技术网

可以在python中查看多个Redis键吗?

可以在python中查看多个Redis键吗?,python,redis,Python,Redis,我最近一直在玩Redis,想知道如何同时观看多个按键。 下面的东西是原子的吗 下面的代码使用redispy while True: try: pipe.watch(key) pipe.watch(another_key) pipe.multi() pipe.set(key, value) pipe.set(another_key, an

我最近一直在玩Redis,想知道如何同时观看多个按键。 下面的东西是原子的吗

下面的代码使用redispy

 while True:            
        try:
            pipe.watch(key)
            pipe.watch(another_key)
            pipe.multi()
            pipe.set(key, value)
            pipe.set(another_key, another_value)
            pipe.execute()

            break
        except redis.WatchError:
            continue

        finally:
            pipe.reset()

redis支持多个键,是:

尽管python客户端的文档说流水线命令是以原子方式执行的,但我仍然会使用带有多个参数的单个
WATCH
调用:

pipe.watch(key, another_key)

哈哈,我已经看了文档至少5次了。好笑的是,我没注意到那些args。