本文整理汇总了Java中redis.clients.jedis.Jedis.zremrangeByScore方法的典型用法代码示例。如果您正苦于以下问题:Java Jedis.zremrangeByScore方法的具体用法?Java Jedis.zremrangeByScore怎么用?Java Jedis.zremrangeByScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.clients.jedis.Jedis
的用法示例。
在下文中一共展示了Jedis.zremrangeByScore方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: moveZRange
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public void moveZRange(String currentKey, String destKey) {
Jedis jedis = null;
try {
jedis = pool.getResource();
ZParams zParams = new ZParams();
zParams.aggregate(ZParams.Aggregate.MIN);
Long count = jedis.zunionstore(destKey, zParams, currentKey, destKey);
Long removedCount = jedis.zremrangeByScore(currentKey.getBytes(), MIN_INF, MAX_INF);
LOGGER.info("{0} tasks in default queue", count);
LOGGER.info("Moved {0} tasks to default queue", removedCount);
pool.returnResource(jedis);
} catch (Exception e) {
LOGGER.severe("Failed to get zunion keys from cache {0}:{1}", currentKey, destKey, e);
pool.returnBrokenResource(jedis);
throw e;
}
}
示例2: zremrangeByScore
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
* 于移除有序集中,指定分数(score)区间内的所有成员
*
* @param key key
* @param maxScore 最小分数(包括)
* @param minScore 最大分数(包括)
* @return 被移除成员的数量
*/
public Long zremrangeByScore(String key, double maxScore, double minScore) {
Jedis jedis = null;
try {
jedis = getConnect();
return jedis.zremrangeByScore(key, maxScore, minScore);
} catch (Exception e) {
logger.error("redis getRedisData data failed!", e);
return 0L;
} finally {
close(jedis);
}
}
示例3: zremrangeByScore
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public Long zremrangeByScore(String key, double start, double end) {
Jedis jedis = null;
Long res = null;
try {
jedis = pool.getResource();
res = jedis.zremrangeByScore(key, start, end);
} catch (Exception e) {
LOGGER.error(e.getMessage());
} finally {
returnResource(pool, jedis);
}
return res;
}