I'm trying to use zpopmax
with a sorted set in python rediscluster
(repo), but the very simple program below fails with AttributeError
.
Question: How can I implement zpopmax
with rediscluster
?
If it's really not implemented, I'll have to use both zrevrange
and zrem
in a transaction to ensure thread safety.
Possibly useful background
I've noticed the command is available in regular (not clustered) redis-py. I also see the command tested in the git repo so I may be missing something easy.
I also tried zpopmax
using regular redis
and get the same error.
My reids-py-cluster is v1.3.6. My redis-py is v2.10.6. My actual Redis is v5.0.4
Code
from rediscluster import StrictRedisCluster as s
rc = s(startup_nodes=[{'host': 'localhost', 'port': '7000'}],
decode_responses=True)
rc.zadd('my-set-name', 3, 'my-key-name')
# print to confirm zadd worked
print(rc.zrange('my-set-name', 0, -1, withscores=True))
# expecting this to print 'my-key-name'
print(rc.zpopmax('my-set-name')) # Attribute Error
I expect the output of the last print statement to be something like 'my-key-name` but I'm getting an AttributeError
Thanks for the help :)