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

The following examples show how to use redis.clients.jedis.params.sortedset.ZAddParams. 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: Jedis.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final String key, final double score, final String member,
    final ZAddParams params) {
  checkIsInMultiOrPipeline();
  client.zadd(key, score, member, params);
  return client.getIntegerReply();
}
 
Example #2
Source File: JedisCluster.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final String key, final double score, final String member,
    final ZAddParams params) {
  return new JedisClusterCommand<Long>(connectionHandler, maxRedirections) {
    @Override
    public Long execute(Jedis connection) {
      return connection.zadd(key, score, member, params);
    }
  }.run(key);
}
 
Example #3
Source File: JedisCluster.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final String key, final Map<String, Double> scoreMembers, final ZAddParams params) {
  return new JedisClusterCommand<Long>(connectionHandler, maxRedirections) {
    @Override
    public Long execute(Jedis connection) {
      return connection.zadd(key, scoreMembers, params);
    }
  }.run(key);
}
 
Example #4
Source File: BinaryJedisCluster.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final byte[] key, final double score, final byte[] member,
    final ZAddParams params) {
  return new JedisClusterCommand<Long>(connectionHandler, maxRedirections) {
    @Override
    public Long execute(Jedis connection) {
      return connection.zadd(key, score, member, params);
    }
  }.runBinary(key);
}
 
Example #5
Source File: BinaryJedisCluster.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final byte[] key, final Map<byte[], Double> scoreMembers, final ZAddParams params) {
  return new JedisClusterCommand<Long>(connectionHandler, maxRedirections) {
    @Override
    public Long execute(Jedis connection) {
      return connection.zadd(key, scoreMembers, params);
    }
  }.runBinary(key);
}
 
Example #6
Source File: BinaryClient.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
public void zadd(final byte[] key, final Map<byte[], Double> scoreMembers, final ZAddParams params) {
  ArrayList<byte[]> args = convertScoreMembersToByteArrays(scoreMembers);
  byte[][] argsArray = new byte[args.size()][];
  args.toArray(argsArray);

  sendCommand(ZADD, params.getByteParams(key, argsArray));
}
 
Example #7
Source File: TracingJedisCluster.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(byte[] key, Map<byte[], Double> scoreMembers, ZAddParams params) {
  Span span = helper.buildSpan("zadd", key);
  span.setTag("scoreMembers", TracingHelper.toStringMap2(scoreMembers));
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  try {
    return super.zadd(key, scoreMembers, params);
  } catch (Exception e) {
    onError(e, span);
    throw e;
  } finally {
    span.finish();
  }
}
 
Example #8
Source File: TracingJedisCluster.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(byte[] key, double score, byte[] member, ZAddParams params) {
  Span span = helper.buildSpan("zadd", key);
  span.setTag("member", Arrays.toString(member));
  span.setTag("score", score);
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  try {
    return super.zadd(key, score, member, params);
  } catch (Exception e) {
    onError(e, span);
    throw e;
  } finally {
    span.finish();
  }
}
 
Example #9
Source File: TracingJedisCluster.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(String key, Map<String, Double> scoreMembers, ZAddParams params) {
  Span span = helper.buildSpan("zadd", key);
  span.setTag("scoreMembers", TracingHelper.toString(scoreMembers));
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  try {
    return super.zadd(key, scoreMembers, params);
  } catch (Exception e) {
    onError(e, span);
    throw e;
  } finally {
    span.finish();
  }
}
 
Example #10
Source File: TracingJedisCluster.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(String key, double score, String member, ZAddParams params) {
  Span span = helper.buildSpan("zadd", key);
  span.setTag("score", score);
  span.setTag("member", member);
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  try {
    return super.zadd(key, score, member, params);
  } catch (Exception e) {
    onError(e, span);
    throw e;
  } finally {
    span.finish();
  }
}
 
Example #11
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(byte[] key, Map<byte[], Double> scoreMembers, ZAddParams params) {
  Span span = helper.buildSpan("zadd", key);
  span.setTag("scoreMembers", TracingHelper.toStringMap2(scoreMembers));
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  return helper.decorate(span, () -> wrapped.zadd(key, scoreMembers, params));
}
 
Example #12
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(byte[] key, double score, byte[] member, ZAddParams params) {
  Span span = helper.buildSpan("zadd", key);
  span.setTag("member", Arrays.toString(member));
  span.setTag("score", score);
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  return helper.decorate(span, () -> wrapped.zadd(key, score, member, params));
}
 
Example #13
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(String key, Map<String, Double> scoreMembers, ZAddParams params) {
  Span span = helper.buildSpan("zadd", key);
  span.setTag("scoreMembers", TracingHelper.toString(scoreMembers));
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  return helper.decorate(span, () -> wrapped.zadd(key, scoreMembers, params));
}
 
Example #14
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(String key, double score, String member, ZAddParams params) {
  Span span = helper.buildSpan("zadd", key);
  span.setTag("score", score);
  span.setTag("member", member);
  span.setTag("params", TracingHelper.toString(params.getByteParams()));
  return helper.decorate(span, () -> wrapped.zadd(key, score, member, params));
}
 
Example #15
Source File: RedisDelayQueue.java    From delay-queue with Apache License 2.0 5 votes vote down vote up
@Override
public boolean setTimeout(String messageId, long timeout) {
	try {
		String json = jedisCluster.hget(messageStoreKey, messageId);
		if (json == null) {
			return false;
		}
		Message message = om.readValue(json, Message.class);
		message.setTimeout(timeout);
		Double score = jedisCluster.zscore(realQueueName, messageId);
		if (score != null) {
			double priorityd = message.getPriority() / 100;
			double newScore = Long.valueOf(System.currentTimeMillis() + timeout).doubleValue() + priorityd;
			ZAddParams params = ZAddParams.zAddParams().xx();
			long added = jedisCluster.zadd(realQueueName, newScore, messageId, params);
			if (added == 1) {
				json = om.writeValueAsString(message);
				jedisCluster.hset(messageStoreKey, message.getId(), json);
				return true;
			}
			return false;
		}
		return false;
	} catch (Exception e) {
		e.printStackTrace();
		return false;
	}
}
 
Example #16
Source File: EnhancedJedisCluster.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final byte[] key, final Map<byte[], Double> scoreMembers, final ZAddParams params) {
	checkArgumentsSpecification(key);
	return new EnhancedJedisClusterCommand<Long>(connectionHandler, maxAttempts) {
		@Override
		public Long doExecute(Jedis connection) {
			return connection.zadd(key, scoreMembers, params);
		}
	}.runBinary(key);
}
 
Example #17
Source File: EnhancedJedisCluster.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final byte[] key, final double score, final byte[] member, final ZAddParams params) {
	checkArgumentsSpecification(key);
	return new EnhancedJedisClusterCommand<Long>(connectionHandler, maxAttempts) {
		@Override
		public Long doExecute(Jedis connection) {
			return connection.zadd(key, score, member, params);
		}
	}.runBinary(key);
}
 
Example #18
Source File: EnhancedJedisCluster.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final String key, final Map<String, Double> scoreMembers, final ZAddParams params) {
	checkArgumentsSpecification(key);
	return new EnhancedJedisClusterCommand<Long>(connectionHandler, maxAttempts) {
		@Override
		public Long doExecute(Jedis connection) {
			return connection.zadd(key, scoreMembers, params);
		}
	}.run(key);
}
 
Example #19
Source File: EnhancedJedisCluster.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Override
public Long zadd(final String key, final double score, final String member, final ZAddParams params) {
	checkArgumentsSpecification(key);
	return new EnhancedJedisClusterCommand<Long>(connectionHandler, maxAttempts) {
		@Override
		public Long doExecute(Jedis connection) {
			return connection.zadd(key, score, member, params);
		}
	}.run(key);
}
 
Example #20
Source File: BinaryClient.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
public void zadd(final byte[] key, final double score, final byte[] member,
    final ZAddParams params) {
  sendCommand(ZADD, params.getByteParams(key, toByteArray(score), member));
}
 
Example #21
Source File: BinaryShardedJedis.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Long zadd(byte[] key, double score, byte[] member, ZAddParams params) {
  Jedis j = getShard(key);
  return j.zadd(key, score, member, params);
}
 
Example #22
Source File: BinaryShardedJedis.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Long zadd(byte[] key, Map<byte[], Double> scoreMembers, ZAddParams params) {
  Jedis j = getShard(key);
  return j.zadd(key, scoreMembers, params);
}
 
Example #23
Source File: PipelineBase.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Response<Long> zadd(byte[] key, double score, byte[] member, ZAddParams params) {
  getClient(key).zadd(key, score, member);
  return getResponse(BuilderFactory.LONG);
}
 
Example #24
Source File: Client.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public void zadd(final String key, final double score, final String member,
    final ZAddParams params) {
  zadd(SafeEncoder.encode(key), score, SafeEncoder.encode(member), params);
}
 
Example #25
Source File: Client.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public void zadd(final String key, final Map<String, Double> scoreMembers, final ZAddParams params) {
  HashMap<byte[], Double> binaryScoreMembers = convertScoreMembersToBinary(scoreMembers);
  zadd(SafeEncoder.encode(key), binaryScoreMembers, params);
}
 
Example #26
Source File: BinaryJedis.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Long zadd(byte[] key, double score, byte[] member, ZAddParams params) {
  checkIsInMultiOrPipeline();
  client.zadd(key, score, member, params);
  return client.getIntegerReply();
}
 
Example #27
Source File: BinaryJedis.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Long zadd(byte[] key, Map<byte[], Double> scoreMembers, ZAddParams params) {
  checkIsInMultiOrPipeline();
  client.zadd(key, scoreMembers, params);
  return client.getIntegerReply();
}
 
Example #28
Source File: PipelineBase.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Response<Long> zadd(String key, double score, String member, ZAddParams params) {
  getClient(key).zadd(key, score, member, params);
  return getResponse(BuilderFactory.LONG);
}
 
Example #29
Source File: PipelineBase.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Override
public Response<Long> zadd(String key, Map<String, Double> scoreMembers, ZAddParams params) {
  getClient(key).zadd(key, scoreMembers, params);
  return getResponse(BuilderFactory.LONG);
}
 
Example #30
Source File: JedisClusterExtend.java    From ns4_frame with Apache License 2.0 4 votes vote down vote up
@Override
public Long zadd(String key, Map<String, Double> scoreMembers, ZAddParams params) {
    throw new UnsupportedOperationException();
}