Commit d2493ce8 by 朱亚洁

feat:[none]redis

parent 57394548
......@@ -13,6 +13,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.Tuple;
import redis.clients.jedis.params.SetParams;
import java.util.*;
......@@ -1617,4 +1618,26 @@ public class JedisClusterUtils {
}
return result;
}
/**
* 获取指定key的Sort-Set集合的元素(按照score从大到小排序)
*
*/
public static Set<Tuple> zrevrangeWithScores(String key, long start, long end) {
try {
return jedisCluster.zrevrangeWithScores(key, start, end);
} catch (Exception e) {
LOGGER.error("jedis有序序列集合的元素失败:" + e.getMessage(), e);
}
return null;
}
public static boolean zset(String key, Map<String, Double> scoreMembers) {
try {
jedisCluster.zadd(key,scoreMembers);
} catch (Exception e) {
LOGGER.error("jedis有序序列集合:添加数据失败:" + e.getMessage(), e);
return false;
}
return true;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment