本文整理匯總了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;
}