本文整理汇总了Java中redis.clients.jedis.params.sortedset.ZAddParams类的典型用法代码示例。如果您正苦于以下问题:Java ZAddParams类的具体用法?Java ZAddParams怎么用?Java ZAddParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ZAddParams类属于redis.clients.jedis.params.sortedset包,在下文中一共展示了ZAddParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@Override
public Long zadd(String key, double score, String member, ZAddParams params) {
try {
if(params.contains("xx")) {
Double existing = redis.zscore(key, member);
if(existing == null) {
return 0L;
}
return redis.zadd(key, new ZsetPair(member, score));
}else {
return redis.zadd(key, new ZsetPair(member, score));
}
} catch (Exception e) {
throw new JedisException(e);
}
}
示例2: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@Override
public Long zadd(String key, Map<String, Double> scoreMembers) {
if (scoreMembers == null || scoreMembers.isEmpty()) {
return 0L;
}
final Jedis resource = this.getResource();
try {
final byte[] rawKey = this.serializeKey(key);
final Map<byte[], Double> rawScoreMembers = new HashMap<byte[], Double>();
for (Map.Entry<String, Double> entry : scoreMembers.entrySet()) {
final byte[] rawField = this.serializeKey(entry.getKey());
rawScoreMembers.put(rawField, entry.getValue());
}
return resource.zadd(rawKey, rawScoreMembers, ZAddParams.zAddParams());
}
catch (Exception e) {
throw new CacheException("redis:zadd", e);
}
finally {
this.returnResource(resource);
}
}
示例3: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@Override
public Long zadd(String key, Map<String, Double> scoreMembers) {
if (scoreMembers == null || scoreMembers.isEmpty()) {
return 0L;
}
try {
final byte[] rawKey = this.serializeKey(key);
final Map<byte[], Double> rawScoreMembers = new HashMap<byte[], Double>();
for (Map.Entry<String, Double> entry : scoreMembers.entrySet()) {
final byte[] rawField = this.serializeKey(entry.getKey());
rawScoreMembers.put(rawField, entry.getValue());
}
return this.jedisCluster.zadd(rawKey, rawScoreMembers, ZAddParams.zAddParams());
}
catch (Exception e) {
throw new CacheException("redis:zadd", e);
}
}
示例4: zaddBinary
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
public void zaddBinary(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));
}
示例5: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@Override
public Long zadd(final String key, final double score, final String member, final ZAddParams params) {
return new JedisClusterCommand<Long>(connectionHandler, maxAttempts) {
@Override
public Long execute(Jedis connection) {
return connection.zadd(key, score, member, params);
}
}.run(key);
}
示例6: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@Override
public Long zadd(final byte[] key, final double score, final byte[] member, final ZAddParams params) {
return new JedisClusterCommand<Long>(connectionHandler, maxAttempts) {
@Override
public Long execute(Jedis connection) {
return connection.zadd(key, score, member, params);
}
}.runBinary(key);
}
示例7: setTimeout
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@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;
}
}
示例8: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@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();
}
}
示例9: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@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();
}
示例10: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
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));
}
示例11: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@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);
}
示例12: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@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);
}
示例13: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
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));
}
示例14: d_zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
public OperationResult<Long> d_zadd(final String key, final double score, final String member,
final ZAddParams params) {
return connPool.executeWithFailover(new BaseKeyOperation<Long>(key, OpName.ZADD) {
@Override
public Long execute(Jedis client, ConnectionContext state) {
return client.zadd(key, score, member, params);
}
});
}
示例15: zadd
import redis.clients.jedis.params.sortedset.ZAddParams; //导入依赖的package包/类
@Override
public Long zadd(String key, double score, String member, ZAddParams params) {
Jedis j = getShard(key);
return j.zadd(key, score, member, params);
}