redis localhost:6379> sadd userlist 1 (integer) 1 redis localhost:6379> sadd userlist 2 (integer) 1 redis localhost:6379> sadd userlist 3 (integer) 1 redis localhost:6379> sadd userlist 4 (integer) 1
redis localhost:6379> sadd userlist 5
(integer) 1
redis localhost:6379> set score:user:1 20 OK redis localhost:6379> set score:user:2 15 OK redis localhost:6379> set score:user:3 11 OK redis localhost:6379> set score:user:4 24 OKredis localhost:6379> set score:user:5 15OKredis localhost:6379> set age:user:1 29 OK redis localhost:6379> set age:user:2 35 OK redis localhost:6379> set age:user:3 25 OK redis localhost:6379> set age:user:4 31OKredis localhost:6379> set age:user:5 27OK如上redis结构,如何实现sort的时候根据score倒排序,如果score相等(上面user2和user5的score相等),那么按照age正排序?期望最后得到的userid排序结果为:4
1
5
2
3
- 2 回答
- 0 关注
- 316 浏览
添加回答
举报
0/150
提交
取消