本文整理了Java中redis.clients.jedis.Pipeline.rpush()
方法的一些代码示例,展示了Pipeline.rpush()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Pipeline.rpush()
方法的具体详情如下:
包路径:redis.clients.jedis.Pipeline
类名称:Pipeline
方法名:rpush
暂无
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public Long rPush(byte[] key, byte[]... values) {
Assert.notNull(key, "Key must not be null!");
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().rpush(key, values)));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().rpush(key, values)));
return null;
}
return connection.getJedis().rpush(key, values);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: com.netflix.dyno/dyno-jedis
@Override
Response<Long> execute(Pipeline jedisPipeline) throws DynoException {
return jedisPipeline.rpush(key, string);
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Response<Long> rpush(String key, String... string) {
String command = "rpush";
return instrumented(command,payloadSize(string), () -> delegated.rpush(key, string));
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Response<Long> rpush(byte[] key, byte[]... string) {
String command = "rpush";
return instrumented(command, payloadSize(string), () -> delegated.rpush(key, string));
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-redis
private void writeUsingListCommand(
KV<String, String> record, Method method, Long expireTime) {
String key = record.getKey();
String value = record.getValue();
if (Method.LPUSH == method) {
pipeline.lpush(key, value);
} else if (Method.RPUSH == method) {
pipeline.rpush(key, value);
}
setExpireTimeWhenRequired(key, expireTime);
}
代码示例来源:origin: gresrun/jesque
/**
* Helper method that encapsulates the minimum logic for adding jobs to a queue.
*
* @param jedis
* the connection to Redis
* @param namespace
* the Resque namespace
* @param queue
* the Resque queue name
* @param jobJsons
* a list of jobs serialized as JSON
*/
public static void doBatchEnqueue(final Jedis jedis, final String namespace, final String queue, final List<String> jobJsons) {
Pipeline pipelined = jedis.pipelined();
pipelined.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);
for (String jobJson : jobJsons) {
pipelined.rpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);
}
pipelined.sync();
}
代码示例来源:origin: xiancloud/xian
@Override
@SuppressWarnings("unchecked")
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
String key = msg.get("key", String.class);
List values = msg.get("values", List.class);
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
try (Jedis jedis = Redis.useDataSource(cacheConfigBean).getResource()) {
if (values != null && !values.isEmpty()) {
String info = ServerOperate.info(jedis, "server");
String redis_mode = ServerOperate.getAttributeInInfo(info, "redis_mode");
if (redis_mode != null && "standalone".equals(redis_mode)) {
Pipeline pipeline = jedis.pipelined();
values.forEach(valueObj -> {
String value = FormatUtil.formatValue(valueObj);
pipeline.rpush(key, value);
});
pipeline.sync();
} else {
values.forEach(valueObj -> {
String value = FormatUtil.formatValue(valueObj);
jedis.rpush(key, value);
});
}
}
} catch (Exception e) {
handler.handle(UnitResponse.createException(e));
return;
}
handler.handle(UnitResponse.createSuccess());
}
代码示例来源:origin: org.springframework.data/spring-data-redis
@Override
public Long rPush(byte[] key, byte[]... values) {
Assert.notNull(key, "Key must not be null!");
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().rpush(key, values)));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().rpush(key, values)));
return null;
}
return connection.getJedis().rpush(key, values);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public Long rPush(byte[] key, byte[]... values) {
Assert.notNull(key, "Key must not be null!");
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().rpush(key, values)));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().rpush(key, values)));
return null;
}
return connection.getJedis().rpush(key, values);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: com.github.biezhi/unique-support-redis
@Override
Object execute() {
if (delOld) {
RedisLock lock = new RedisLock(key, shardedJedisPool);
lock.lock();
try {
Pipeline pipeline = jedis.getShard(key).pipelined();
pipeline.del(key);
for (String value : values) {
pipeline.rpush(key, value);
}
pipeline.sync();
} finally {
lock.unlock();
}
} else {
jedis.rpush(key, values);
}
return null;
}
}.getResult();
代码示例来源:origin: gojektech/feast
private Response<?> writeRecord(RedisMutation mutation) {
switch (mutation.getMethod()) {
case APPEND:
return pipeline.append(mutation.getKey(), mutation.getValue());
case SET:
return pipeline.set(mutation.getKey(), mutation.getValue());
case LPUSH:
return pipeline.lpush(mutation.getKey(), mutation.getValue());
case RPUSH:
return pipeline.rpush(mutation.getKey(), mutation.getValue());
case SADD:
return pipeline.sadd(mutation.getKey(), mutation.getValue());
case ZADD:
return pipeline.zadd(mutation.getKey(), mutation.getScore(), mutation.getValue());
default:
throw new UnsupportedOperationException(
String.format("Not implemented writing records for %s", mutation.getMethod()));
}
}
内容来源于网络,如有侵权,请联系作者删除!