本文整理匯總了Java中redis.clients.jedis.Jedis.zrangeByScore方法的典型用法代碼示例。如果您正苦於以下問題:Java Jedis.zrangeByScore方法的具體用法?Java Jedis.zrangeByScore怎麽用?Java Jedis.zrangeByScore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類redis.clients.jedis.Jedis
的用法示例。
在下文中一共展示了Jedis.zrangeByScore方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: zrangeByScore
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public Set<String> zrangeByScore(String key, long min, long max, int limit) {
Jedis jedis = null;
boolean success = true;
Set<String> ret = null;
try {
jedis = jedisPool.getResource();
if (jedis == null) {
success = false;
return ret;
}
ret = jedis.zrangeByScore(key, min, max, 0, limit);
} catch (Exception e) {
success = false;
returnBrokenResource(jedis, "zrangeByScore", e);
} finally {
releaseReidsSource(success, jedis);
}
return ret;
}
示例2: zrangeByScore
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/**
* 指定區間內,有序集成員的列表。(從小--->大)
*
* @param key key
* @param minScore 最小分數(包括),用'-inf'表示負無窮
* @param maxScore 最大分數(包括),用'+inf'標識正無窮
* @param offset 偏移量
* @param count 返回總數
* @return 有序集成員的列表
*/
public Set<String> zrangeByScore(String key, String minScore, String maxScore, int offset, int count) {
Jedis jedis = null;
try {
jedis = getConnect();
if (offset > -1 && count > 0) {
return jedis.zrangeByScore(key, minScore, maxScore, offset, count);
} else {
return jedis.zrangeByScore(key, minScore, maxScore);
}
} catch (Exception e) {
logger.error("redis getRedisData data failed!", e);
return null;
} finally {
close(jedis);
}
}
示例3: zrevrangeByScore
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/**
* 指定區間內,有序集成員的列表。(從大--->小)
*
* @param key key
* @param maxScore 最小分數(包括),用'+inf'表示負無窮
* @param minScore 最大分數(包括),用'-inf'標識正無窮
* @param offset 偏移量
* @param count 返回總數
* @return 有序集成員的列表
*/
public Set<String> zrevrangeByScore(String key, String maxScore, String minScore, int offset, int count) {
Jedis jedis = null;
try {
jedis = getConnect();
if (offset > -1 && count > 0) {
return jedis.zrevrangeByScore(key, maxScore, minScore, offset, count);
} else {
return jedis.zrangeByScore(key, maxScore, minScore);
}
} catch (Exception e) {
logger.error("redis getRedisData data failed!", e);
return null;
} finally {
close(jedis);
}
}
示例4: zGet
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public Set<Object> zGet(String key, double minScore, double maxScore, int offset, int count) {
int tries = 0;
boolean sucess = false;
Set<String> retVal = null;
do {
tries++;
try {
Jedis jedis = pool.getResource();
retVal = jedis.zrangeByScore(key, minScore, maxScore, offset, count);
jedis.close();
sucess = true;
} catch (JedisConnectionException ex) {
log.error(RedisConstants.CONN_FAILED_RETRY_MSG + tries);
if (tries == numRetries)
throw ex;
}
} while (!sucess && tries <= numRetries);
return SerializationUtil.deSerialize(retVal);
}