本文整理汇总了Java中redis.clients.jedis.ShardedJedis.rpush方法的典型用法代码示例。如果您正苦于以下问题:Java ShardedJedis.rpush方法的具体用法?Java ShardedJedis.rpush怎么用?Java ShardedJedis.rpush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.clients.jedis.ShardedJedis
的用法示例。
在下文中一共展示了ShardedJedis.rpush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pushWhenNoRepeat
import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Override
protected void pushWhenNoRepeat(Task task, Request request) {
ShardedJedis jedis = jedisPool.getResource();
try {
String content = serializer.serialize(request);
if(request.getPriority() == 0) {
jedis.rpush(RedisKeys.getQueueNoPriorityKey(task), content);
} else if (request.getPriority() > 0) {
jedis.zadd(RedisKeys.getZsetPlusPriorityKey(task), request.getPriority(), content);
} else {
jedis.zadd(RedisKeys.getZsetMinusPriorityKey(task), request.getPriority(), content);
}
jedis.sadd(RedisKeys.getSetKey(task), request.key());
} finally {
jedis.close();
}
}
示例2: pushWhenNoRepeat
import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Override
protected void pushWhenNoRepeat(Task task, Request request) {
ShardedJedis jedis = jedisPool.getResource();
try {
jedis.rpush(RedisKeys.getQueueKey(task), serializer.serialize(request));
} finally {
jedis.close();
}
}
示例3: add
import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Override
public void add(List<Object> objectList) {
ShardedJedis jedis = JedisPoolManager.getResource();
List<String> values = new ArrayList<>();
for (Object o : objectList) {
UserVisitBean userVisitBean = (UserVisitBean) o;
values.add(JSON.toJSONString(userVisitBean));
}
jedis.rpush(TableConstants.TABLE_USER_VISIT, values.toArray(new String[0]));
jedis.close();
}
示例4: add
import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Override
public void add(List<Object> objectList) {
String key = null;
ShardedJedis jedis = JedisPoolManager.getResource();
for (Object o : objectList) {
UserVisitTimeBean userVisitTimeBean = (UserVisitTimeBean) o;
key = String.valueOf(userVisitTimeBean.getShopId()) + "||"
+ userVisitTimeBean.getMac();
jedis.rpush(key, String.valueOf(userVisitTimeBean.getVisitTime()));
}
jedis.close();
}