@Override public Double hIncrBy(byte[] key, byte[] field, double delta) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Field must not be null!"); try { return connection.getCluster().hincrByFloat(key, field, delta); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Double hincrByFloat(byte[] bytes, byte[] bytes1, double v) { return cluster.hincrByFloat(bytes, bytes1, v); }
public Double hincrByFloat(String key, String field, double value) { return jedisCluster.hincrByFloat(key, field, value); }
public Double hincrByFloat(byte[] key, byte[] field, double value) { return jedisCluster.hincrByFloat(key, field, value); }
@Override public Double hIncrBy(byte[] key, byte[] field, double delta) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Field must not be null!"); try { return connection.getCluster().hincrByFloat(key, field, delta); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Double hIncrBy(byte[] key, byte[] field, double delta) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Field must not be null!"); try { return connection.getCluster().hincrByFloat(key, field, delta); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
/** * 为哈希表 key 中的域 field 加上浮点数增量 increment 。 * 如果哈希表中没有域 field ,那么 HINCRBYFLOAT 会先将域 field 的值设为 0 ,然后再执行加法操作。 * 如果键 key 不存在,那么 HINCRBYFLOAT 会先创建一个哈希表,再创建域 field ,最后再执行加法操作。 * 当以下任意一个条件发生时,返回一个错误: * 1:域 field 的值不是字符串类型(因为 redis 中的数字和浮点数都以字符串的形式保存,所以它们都属于字符串类型) * 2:域 field 当前的值或给定的增量 increment 不能解释(parse)为双精度浮点数(double precision floating point number) * HINCRBYFLOAT 命令的详细功能和 INCRBYFLOAT 命令类似,请查看 INCRBYFLOAT 命令获取更多相关信息。 */ public Double hincrByFloat(Object key, Object field, double value) { return jedisCluster.hincrByFloat(keyToBytes(key), valueToBytes(field), value); }
@Override public double hincrByFloat(final String key, final String field, final double value) { Assert.hasText(key); Assert.hasText(field); try { final Double val = cluster.hincrByFloat(key, field, value); if (val == null) { return 0; } return val.doubleValue(); } catch (final Throwable e) { throw new RedisClientException(e.getMessage(), e); } }