我在我的 python 项目中使用 redis 2.8.4。在特定的排序集中,我想使用 nx
选项来 zadd
。 nx
选项未记录在 redis-py 中文档,并根据 to the docs , 它只适用于 redis 3.0.2 或更高版本。
那么在执行 zadd
时,我可以遵循什么替代模式来模拟 nx
选项?
最佳答案
我在 github issue 中找到了解决方案:
redis.execute_command('ZADD', set_name, 'NX', score, key)
关于python - 在 redis-py 中执行 zadd 时使用 nx 选项(redis ver 2.8.4),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41188811/