本文整理汇总了Java中redis.clients.jedis.Jedis.zcount方法的典型用法代码示例。如果您正苦于以下问题:Java Jedis.zcount方法的具体用法?Java Jedis.zcount怎么用?Java Jedis.zcount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.clients.jedis.Jedis
的用法示例。
在下文中一共展示了Jedis.zcount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zcount
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public long zcount(String key) {
long ret = 0L;
Jedis jedis = null;
boolean success = true;
try {
jedis = jedisPool.getResource();
if (jedis == null) {
success = false;
return ret;
}
ret = jedis.zcount(key, 0, Long.MAX_VALUE);
} catch (Exception e) {
success = false;
returnBrokenResource(jedis, "zcount key:" + key, e);
} finally {
releaseReidsSource(success, jedis);
}
return ret;
}
示例2: zCount
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public Long zCount(String key) {
int tries = 0;
boolean sucess = false;
Long retVal = null;
do {
tries++;
try {
Jedis jedis = pool.getResource();
retVal = jedis.zcount(key, 0, Double.MAX_VALUE);
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 retVal;
}
示例3: zcount
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
* 计算在有序集合中指定区间分数的成员数
*
* @param key key
* @param minScore minScore
* @param maxScore maxScore
* @return Long
*/
public Long zcount(String key, double minScore, double maxScore) {
Jedis jedis = null;
try {
jedis = getConnect();
return jedis.zcount(key, minScore, maxScore);
} catch (Exception e) {
logger.error("redis getRedisData data failed!", e);
return 0L;
} finally {
close(jedis);
}
}
示例4: zcount
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public Long zcount(String key, String min, String max) {
Jedis jedis = null;
Long res = null;
try {
jedis = pool.getResource();
res = jedis.zcount(key, min, max);
} catch (Exception e) {
LOGGER.error(e.getMessage());
} finally {
returnResource(pool, jedis);
}
return res;
}