Redis ordered set based on multiple criteria

I am trying to create a redis ordered set . Capture is the need for ordering based on two criteria, timestamp and evaluation. But in redis, I can provide only one search criteria:

ZADD {key} {timestamp} {value} 

How to add an invoice to this order as well as plz?

Update: Here is the approach I took to combine two different ordering factoring into a single floating point value:

 var score = Math.floor(result.created_time/(60*60*24*1000)); score = score + (result.matches/10); 

Just to explain, I first converted the timestamp to the number of days. And my match value is usually 0-10. Thus, it is converted to a decimal value and added as the weight of the fraction. Which gives me the highest scored entries sorted per day. This is exactly what I need.

+5
source share
1 answer

Use decimal numbers as points in your sorted set - create an account, and the timestamp is the value to the left of the decimal point and the value to the right.

+4
source

All Articles