redis.clients.jedis.params.sortedset.ZIncrByParams Java Examples

The following examples show how to use redis.clients.jedis.params.sortedset.ZIncrByParams. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EnhancedJedisCluster.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(final String key, final double score, final String member, final ZIncrByParams params) {
	checkArgumentsSpecification(key);
	return new EnhancedJedisClusterCommand<Double>(connectionHandler, maxAttempts) {
		@Override
		public Double doExecute(Jedis connection) {
			return connection.zincrby(key, score, member, params);
		}
	}.run(key);
}
 
Example #2
Source File: SortedSetCommandsTest.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Test
public void zincrbyWithParams() {
  jedis.del("foo");

  // xx: never add new member
  Double score = jedis.zincrby("foo", 2d, "a", ZIncrByParams.zIncrByParams().xx());
  assertNull(score);

  jedis.zadd("foo", 2d, "a");

  // nx: never update current member
  score = jedis.zincrby("foo", 1d, "a", ZIncrByParams.zIncrByParams().nx());
  assertNull(score);
  assertEquals(Double.valueOf(2d), jedis.zscore("foo", "a"));

  // Binary

  jedis.del(bfoo);

  // xx: never add new member
  score = jedis.zincrby(bfoo, 2d, ba, ZIncrByParams.zIncrByParams().xx());
  assertNull(score);

  jedis.zadd(bfoo, 2d, ba);

  // nx: never update current member
  score = jedis.zincrby(bfoo, 1d, ba, ZIncrByParams.zIncrByParams().nx());
  assertNull(score);
  assertEquals(Double.valueOf(2d), jedis.zscore(bfoo, ba));
}
 
Example #3
Source File: BinaryJedisCluster.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(final byte[] key, final double score, final byte[] member,
    final ZIncrByParams params) {
  return new JedisClusterCommand<Double>(connectionHandler, maxRedirections) {
    @Override
    public Double execute(Jedis connection) {
      return connection.zincrby(key, score, member, params);
    }
  }.runBinary(key);
}
 
Example #4
Source File: JedisCluster.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(final String key, final double score, final String member,
    final ZIncrByParams params) {
  return new JedisClusterCommand<Double>(connectionHandler, maxRedirections) {
    @Override
    public Double execute(Jedis connection) {
      return connection.zincrby(key, score, member, params);
    }
  }.run(key);
}
 
Example #5
Source File: BinaryJedis.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(byte[] key, double score, byte[] member, ZIncrByParams params) {
  checkIsInMultiOrPipeline();
  client.zincrby(key, score, member, params);
  String newscore = client.getBulkReply();

  // with nx / xx options it could return null now
  if (newscore == null) return null;

  return Double.valueOf(newscore);
}
 
Example #6
Source File: Jedis.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(String key, double score, String member, ZIncrByParams params) {
  checkIsInMultiOrPipeline();
  client.zincrby(key, score, member, params);
  String newscore = client.getBulkReply();

  // with nx / xx options it could return null now
  if (newscore == null) return null;

  return Double.valueOf(newscore);
}
 
Example #7
Source File: EnhancedJedisCluster.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(final byte[] key, final double score, final byte[] member, final ZIncrByParams params) {
	checkArgumentsSpecification(key);
	return new EnhancedJedisClusterCommand<Double>(connectionHandler, maxAttempts) {
		@Override
		public Double doExecute(Jedis connection) {
			return connection.zincrby(key, score, member, params);
		}
	}.runBinary(key);
}
 
Example #8
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(String key, double score, String member, ZIncrByParams params) {
  Span span = helper.buildSpan("zincrby", key);
  span.setTag("score", score);
  span.setTag("member", member);
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  return helper.decorate(span, () -> wrapped.zincrby(key, score, member, params));
}
 
Example #9
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(byte[] key, double increment, byte[] member, ZIncrByParams params) {
  Span span = helper.buildSpan("zincrby", key);
  span.setTag("increment", increment);
  span.setTag("member", Arrays.toString(member));
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  return helper.decorate(span, () -> wrapped.zincrby(key, increment, member, params));
}
 
Example #10
Source File: TracingJedisCluster.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(String key, double score, String member, ZIncrByParams params) {
  Span span = helper.buildSpan("zincrby", key);
  span.setTag("score", score);
  span.setTag("member", member);
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  try {
    return super.zincrby(key, score, member, params);
  } catch (Exception e) {
    onError(e, span);
    throw e;
  } finally {
    span.finish();
  }
}
 
Example #11
Source File: TracingJedisCluster.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Double zincrby(byte[] key, double score, byte[] member, ZIncrByParams params) {
  Span span = helper.buildSpan("zincrby", key);
  span.setTag("member", Arrays.toString(member));
  span.setTag("score", score);
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  try {
    return super.zincrby(key, score, member, params);
  } catch (Exception e) {
    onError(e, span);
    throw e;
  } finally {
    span.finish();
  }
}
 
Example #12
Source File: BinaryClient.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
public void zincrby(final byte[] key, final double score, final byte[] member,
    final ZIncrByParams params) {
  // Note that it actually calls ZADD with INCR option, so it requires Redis 3.0.2 or upper.
  sendCommand(ZADD, params.getByteParams(key, toByteArray(score), member));
}
 
Example #13
Source File: JedisClusterExtend.java    From ns4_frame with Apache License 2.0 4 votes vote down vote up
@Override
public Double zincrby(String key, double score, String member, ZIncrByParams params) {
    throw new UnsupportedOperationException();
}
 
Example #14
Source File: PipelineBase.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Response<Double> zincrby(byte[] key, double score, byte[] member, ZIncrByParams params) {
  getClient(key).zincrby(key, score, member);
  return getResponse(BuilderFactory.DOUBLE);
}
 
Example #15
Source File: PipelineBase.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Response<Double> zincrby(String key, double score, String member, ZIncrByParams params) {
  getClient(key).zincrby(key, score, member, params);
  return getResponse(BuilderFactory.DOUBLE);
}
 
Example #16
Source File: Client.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public void zincrby(String key, double score, String member, ZIncrByParams params) {
  zincrby(SafeEncoder.encode(key), score, SafeEncoder.encode(member), params);
}
 
Example #17
Source File: BinaryShardedJedis.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Double zincrby(byte[] key, double score, byte[] member, ZIncrByParams params) {
  Jedis j = getShard(key);
  return j.zincrby(key, score, member, params);
}
 
Example #18
Source File: ShardedJedis.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Double zincrby(String key, double score, String member, ZIncrByParams params) {
  Jedis j = getShard(key);
  return j.zincrby(key, score, member, params);
}
 
Example #19
Source File: RedisPipeline.java    From cachecloud with Apache License 2.0 votes vote down vote up
Response<Double> zincrby(String key, double score, String member, ZIncrByParams params); 
Example #20
Source File: BinaryJedisCommands.java    From cachecloud with Apache License 2.0 votes vote down vote up
Double zincrby(byte[] key, double score, byte[] member, ZIncrByParams params); 
Example #21
Source File: JedisClusterCommands.java    From cachecloud with Apache License 2.0 votes vote down vote up
Double zincrby(String key, double score, String member, ZIncrByParams params); 
Example #22
Source File: BinaryJedisClusterCommands.java    From cachecloud with Apache License 2.0 votes vote down vote up
Double zincrby(byte[] key, double score, byte[] member, ZIncrByParams params); 
Example #23
Source File: BinaryRedisPipeline.java    From cachecloud with Apache License 2.0 votes vote down vote up
Response<Double> zincrby(byte[] key, double score, byte[] member, ZIncrByParams params); 
Example #24
Source File: JedisCommands.java    From cachecloud with Apache License 2.0 votes vote down vote up
Double zincrby(String key, double score, String member, ZIncrByParams params); 
Example #25
Source File: RedisPipeline.java    From cachecloud with Apache License 2.0 votes vote down vote up
Response<Double> zincrby(String key, double score, String member, ZIncrByParams params); 
Example #26
Source File: Commands.java    From cachecloud with Apache License 2.0 votes vote down vote up
void zincrby(final String key, final double score, final String member, final ZIncrByParams params);