3 ms·
TOTALLY off topic and I truly apologize but I believe this is where I'll get the answer the quickest: If, in a Redis sorted set, two values have the same score
by mladenkovacevic 13y ago
TOTALLY off topic and I truly apologize but I believe this is where I'll get the answer the quickest:
If, in a Redis sorted set, two values have the same score, retrieving a range of values that includes those two values will present them in the alphabetical order right? So in this way one of those two values with score can be cut out of the retrieval by limiting the range appropriately. This leads me to believe that each value in a sorted set should have a unique score even though the uniqueness is not forced or encouraged in any way at the point of value/score assignment. What would be a real-world use case scenario for such a structure then when?
- audreyt 13y agoWell, limiting the range, commonly associated with a paging (or infinitely scrolling) UI, entails tie-breaking somehow. A simple tiebreak function — such as lexicographic sorting on keys — means when the user requests "next page" via another range request, the same-scored second value will predictably show up on the beginning of next page, which is how users will expect in the real world. Hope this helps!