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

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

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

JedisCluster.incrBy介绍

暂无

代码示例

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

@Override
public Long incrBy(byte[] key, long value) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().incrBy(key, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: hhfcyong/xxxx-dubbo

/**
* 将 key 所储存的值加上增量 increment 
* 如果 key 不存在,那么 key 的值会先被初始化为 0 ,然后再执行 INCRBY 命令
* 如果值包含错误的类型,或字符串类型的值不能表示为数字,那么返回一个错误
* @param key
* @param integer
* @return 加上 increment 之后, key 的值
*/
public Long incrBy(String key,long integer){
  return jedisCluster.incrBy(key, integer);
}
/**

代码示例来源:origin: net.oschina.j2cache/j2cache-core

@Override
public Long incrBy(byte[] bytes, long l) {
  return cluster.incrBy(bytes, l);
}

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

public Long incrBy(byte[] key, long integer) {
  return jedisCluster.incrBy(key, integer);
}

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

public Long incrBy(String key, long integer) {
  return jedisCluster.incrBy(key, integer);
}

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

/**
 * 将 key 所储存的值加上增量 increment 。
 * 如果 key 不存在,那么 key 的值会先被初始化为 0 ,然后再执行 INCRBY 命令。
 * 如果值包含错误的类型,或字符串类型的值不能表示为数字,那么返回一个错误。
 * 本操作的值限制在 64 位(bit)有符号数字表示之内。
 * 关于递增(increment) / 递减(decrement)操作的更多信息,参见 INCR 命令。
 */
public Long incrBy(Object key, long longValue) {
  return jedisCluster.incrBy(keyToBytes(key), longValue);
}

代码示例来源:origin: com.github.yamingd.argo/argo-redis

@Override
public long incr(String key, Integer amount) {
  return jedisCluster.incrBy(SafeEncoder.encode(key), amount);
}

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

@Override
public Long incrBy(byte[] key, long value) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().incrBy(key, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Long incrBy(byte[] key, long value) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().incrBy(key, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: org.nanoframework/nano-orm-jedis

@Override
public long incrBy(final String key, final long value) {
  Assert.hasText(key);
  try {
    final Long val = cluster.incrBy(key, value);
    if (val == null) {
      return 0;
    }
    return val.longValue();
  } catch (final Throwable e) {
    throw new RedisClientException(e.getMessage(), e);
  }
}

代码示例来源:origin: yrain/smart-cache

/**
 * 将 key 所储存的值加上增量 increment 。
 * 如果 key 不存在,那么 key 的值会先被初始化为 0 ,然后再执行 INCRBY 命令。
 * 如果值包含错误的类型,或字符串类型的值不能表示为数字,那么返回一个错误。
 * 返回值:加上 increment 之后, key 的值。
 */
public Long incrBy(Object key, long value) {
  if (null == key) {
    return null;
  }
  if (cluster) {
    return jedisCluster.incrBy(serializeKey(key), value);
  } else {
    return jedisOperator.incrBy(serializeKey(key), value);
  }
}

相关文章

微信公众号

最新文章

更多

JedisCluster类方法