核心代码:
@Override
public void zAdd(String key, String value, Integer score, Long expireTime) {
// 加上小数, 同样的分数,提交的时间越早,排名越靠前。 取10000000000000L为参考,是防止小数为太多。
Double tempScore = new Double(score + "." + (10000000000000L- System.currentTimeMillis()));
redisTemplate.opsForZSet().add(key, value, tempScore);
expire(key, expireTime);
}
ZSET 使用
https://www.cnblogs.com/chenziyu/p/9225233.html
排行榜:
https://www.zhihu.com/question/422129542/answer/2432924690 (最重要)
https://www.cnblogs.com/qiaojushuang/p/9657179.html
https://cloud.tencent.com/developer/article/1370111