本文整理汇总了Java中redis.clients.jedis.Jedis.zincrby方法的典型用法代码示例。如果您正苦于以下问题:Java Jedis.zincrby方法的具体用法?Java Jedis.zincrby怎么用?Java Jedis.zincrby使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.clients.jedis.Jedis
的用法示例。
在下文中一共展示了Jedis.zincrby方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zIncrBy
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
* 增加值
*
* @param key
* @param member
* @param value
* @return
*/
public boolean zIncrBy(String key, String member, long value) {
Jedis jedis = null;
boolean success = true;
boolean ret = false;
try {
jedis = jedisPool.getResource();
if (jedis == null) {
success = false;
return false;
}
// 记录最后一个心跳时间
ret = (jedis.zincrby(key, value, member) > 0);
} catch (Exception e) {
success = false;
returnBrokenResource(jedis, "zIncrBy key:" + key + "member:" + member + "value:" + value, e);
} finally {
releaseReidsSource(success, jedis);
}
return ret;
}
示例2: zincrby
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
* 对有序集合中指定成员的分数加上增量 increment
*
* @param key key
* @param score score
* @param object Object
*/
public boolean zincrby(String key, double score, Object object) {
Jedis jedis = null;
try {
jedis = getConnect();
jedis.zincrby(key, score, object.toString());
} catch (Exception e) {
logger.error("redis zadd data failed!", e);
return false;
} finally {
close(jedis);
}
return true;
}
示例3: zincrby
import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public Double zincrby(String key, double score, String member) {
Jedis jedis = null;
Double res = null;
try {
jedis = pool.getResource();
res = jedis.zincrby(key, score, member);
} catch (Exception e) {
LOGGER.error(e.getMessage());
} finally {
returnResource(pool, jedis);
}
return res;
}