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