question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why there isn't `ZPOPMAX` in Sorted Set?

See original GitHub issue

I’d like to pop the value with the max score, but redis-py does not have zpopmax nor zpopmin.

So what are the suitable replaces of ZPOPMAX and ZPOPMIN?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ramwincommented, Jul 6, 2018

See this?. Zpopmin and Zpopmax is new command in redis 5.0.0, maybe the command is in developing. I use zrevrange('yourkey', 0, 1) to get the max value and then zrem('yourkey') to delete the element.

0reactions
namanjain2707commented, Apr 24, 2019

Yes, if you want to ensure the thread safe, you should do some extra work using pipelining or transactions.

You need to use both pipelining AND transactions. Pipelining just ensures that the commands are executed in order and also reduces the RTT(Round Trip Time). Transactions are the ones that ensure atomicity of the commands in execution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why there isn't ZPOPMAX in Sorted Set? #1003 - GitHub
I'd like to pop the value with the max score, but redis-py does not have zpopmax nor zpopmin. So what are the suitable...
Read more >
Is there good way to support pop members from the Redis ...
What I figured out for poping message from the Redis Sorted Set is using ZRANGE +ZREM , however it is not thread security...
Read more >
How to get highest score element of a sorted set – Redis ...
ZPOPMAX Command​​ This command removes and returns one or more highest score elements from the sorted set value stored at a specified key....
Read more >
ANTIREZ on Twitter: "5) Sorted sets are now like lists! They ...
We release every 1 / 1.5 years more or less, there is no point in saying 3.2 ... ZPOPMAX. Remove and return members...
Read more >
ZADD - Redis
Sorted sets are sorted by their score in an ascending way. The same element only exists a single time, no repeated elements are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found