redis.clients.jedis.Jedis.zincrby()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(313)

本文整理了Java中redis.clients.jedis.Jedis.zincrby()方法的一些代码示例,展示了Jedis.zincrby()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.zincrby()方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:zincrby

Jedis.zincrby介绍

[英]If member already exists in the sorted set adds the increment to its score and updates the position of the element in the sorted set accordingly. If member does not already exist in the sorted set it is added with increment as score (that is, like if the previous score was virtually zero). If key does not exist a new sorted set with the specified member as sole member is created. If the key exists but does not hold a sorted set value an error is returned.

The score value can be the string representation of a double precision floating point number. It's possible to provide a negative value to perform a decrement.

For an introduction to sorted sets check the Introduction to Redis data types page.

Time complexity O(log(N)) with N being the number of elements in the sorted set
[中]如果成员已存在于排序集中,则向其分数添加增量,并相应地更新元素在排序集中的位置。如果成员在已排序的集合中不存在,则添加增量作为分数(也就是说,如果前一个分数实际上为零)。若键不存在,将创建一个新的排序集,其中指定的成员为唯一成员。如果键存在但不包含排序集值,则返回错误。
分数值可以是双精度浮点数的字符串表示形式。可以提供负值来执行递减。
有关排序集的介绍,请查看Redis数据类型介绍页面。
时间复杂度O(log(N)),N是排序集中的元素数

代码示例

代码示例来源:origin: sohutv/cachecloud

@Override
 public Double execute(Jedis connection) {
  return connection.zincrby(key, score, member, params);
 }
}.runBinary(key);

代码示例来源:origin: sohutv/cachecloud

public Double execute(Jedis connection) {
    return connection.zincrby(keyByte, score, member);
  }
}.runBinary(keyByte);

代码示例来源:origin: sohutv/cachecloud

@Override
 public Double execute(Jedis connection) {
  return connection.zincrby(key, score, member);
 }
}.run(key);

代码示例来源:origin: sohutv/cachecloud

@Override
 public Double execute(Jedis connection) {
  return connection.zincrby(key, score, member, params);
 }
}.run(key);

代码示例来源:origin: sohutv/cachecloud

@Override
 public Double execute(Jedis connection) {
  return connection.zincrby(key, score, member);
 }
}.runBinary(key);

代码示例来源:origin: sohutv/cachecloud

@Override
public Double zincrby(String key, double score, String member, ZIncrByParams params) {
 Jedis j = getShard(key);
 return j.zincrby(key, score, member, params);
}

代码示例来源:origin: sohutv/cachecloud

@Override
public Double zincrby(String key, double score, String member) {
 Jedis j = getShard(key);
 return j.zincrby(key, score, member);
}

代码示例来源:origin: sohutv/cachecloud

@Override
public Double zincrby(byte[] key, double score, byte[] member, ZIncrByParams params) {
 Jedis j = getShard(key);
 return j.zincrby(key, score, member, params);
}

代码示例来源:origin: sohutv/cachecloud

@Override
public Double zincrby(byte[] key, double score, byte[] member) {
 Jedis j = getShard(key);
 return j.zincrby(key, score, member);
}

代码示例来源:origin: Netflix/conductor

@Override
public Double zincrby(String key, double score, String member) {
 Jedis jedis = null;
  try {
   jedis = jedisPool.getResource();
   return jedis.zincrby(key, score, member);
  } finally {
   if (jedis != null)
    jedis.close();
  }
}

代码示例来源:origin: Netflix/conductor

@Override
public Double zincrby(String key, double score, String member, ZIncrByParams params) {
 Jedis jedis = null;
  try {
   jedis = jedisPool.getResource();
   return jedis.zincrby(key, score, member, params);
  } finally {
   if (jedis != null)
    jedis.close();
  }
}

代码示例来源:origin: jfinal/jfinal

/**
 * 为有序集 key 的成员 member 的 score 值加上增量 increment 。
 */
public Double zincrby(Object key, double score, Object member) {
  Jedis jedis = getJedis();
  try {
    return jedis.zincrby(keyToBytes(key), score, valueToBytes(member));
  }
  finally {close(jedis);}
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Double zIncrBy(byte[] key, double increment, byte[] value) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(value, "Value must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().zincrby(key, increment, value)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().zincrby(key, increment, value)));
      return null;
    }
    return connection.getJedis().zincrby(key, increment, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: jwpttcg66/NettyGameServer

/**
 * 增加值
 * @param key
 * @param member
 * @param value
 * @return
 */
public boolean zIncrBy(String key, String member, long value){
  Jedis jedis = null;
  boolean sucess = true;
  try {
    jedis = jedisPool.getResource();
    //记录最后一个心跳时间
    jedis.zincrby(key, value, member);
  } catch (Exception e) {
    sucess = false;
    returnBrokenResource(jedis, "zIncrBy key:"+key + "member:" + member + "value:"+ value, e);
  } finally {
    if (sucess && jedis != null) {
      returnResource(jedis);
    }
  }
  return sucess;
}

代码示例来源:origin: com.github.sogyf/goja-mvt

@Override
  public Double action(Jedis jedis) {
    return jedis.zincrby(key, score, member);
  }
});

代码示例来源:origin: apache/servicemix-bundles

@Override
 public Double execute(Jedis connection) {
  return connection.zincrby(key, increment, member);
 }
}.run(key);

代码示例来源:origin: apache/servicemix-bundles

@Override
public Double zincrby(final byte[] key, final double increment, final byte[] member) {
 Jedis j = getShard(key);
 return j.zincrby(key, increment, member);
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

public Double zincrby(byte[] key, double score, byte[] member, ZIncrByParams params) {
  Jedis jedis = getJedis();
  try {
    return jedis.zincrby(key, score, member, params);
  } finally {Streams.safeClose(jedis);}
}

代码示例来源:origin: yangfuhai/jboot

/**
 * 为有序集 key 的成员 member 的 score 值加上增量 increment 。
 */
public Double zincrby(Object key, double score, Object member) {
  Jedis jedis = getJedis();
  try {
    return jedis.zincrby(keyToBytes(key), score, valueToBytes(member));
  } finally {
    returnResource(jedis);
  }
}

代码示例来源:origin: com.jfinal/jfinal

/**
 * 为有序集 key 的成员 member 的 score 值加上增量 increment 。
 */
public Double zincrby(Object key, double score, Object member) {
  Jedis jedis = getJedis();
  try {
    return jedis.zincrby(keyToBytes(key), score, valueToBytes(member));
  }
  finally {close(jedis);}
}

相关文章

Jedis类方法