本文整理了Java中io.vertx.redis.RedisClient.lrange
方法的一些代码示例,展示了RedisClient.lrange
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisClient.lrange
方法的具体详情如下:
包路径:io.vertx.redis.RedisClient
类名称:RedisClient
方法名:lrange
[英]Get a range of elements from a list
[中]从列表中获取一系列元素
代码示例来源:origin: xenv/gushici
private void getHelpFromRedis(Message message) {
redisClient.lrange(Key.REDIS_HELP_LIST, 0, -1, res -> {
if (res.succeeded()) {
JsonArray array = res.result();
JsonArray newArray = array.stream()
.map(text -> {
String prefix = config().getString("api.url", "http://localhost/");
return new JsonObject((String) text).stream()
.collect(Collectors.toMap(Map.Entry::getKey,
v -> prefix + v.getValue().toString().replace(":", "/")));
})
.collect(JsonCollector.toJsonArray());
message.reply(newArray);
} else {
log.error("Fail to get data from Redis", res.cause());
message.fail(500, res.cause().getMessage());
}
});
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Get a range of elements from a list
* @param key Key string
* @param from Start index
* @param to Stop index
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient lrange(String key, long from, long to, Handler<AsyncResult<JsonArray>> handler) {
delegate.lrange(key, from, to, handler);
return this;
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Get a range of elements from a list
* @param key Key string
* @param from Start index
* @param to Stop index
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient lrange(String key, long from, long to, Handler<AsyncResult<JsonArray>> handler) {
delegate.lrange(key, from, to, handler);
return this;
}
代码示例来源:origin: sczyh30/vertx-kue
@Override
public JobService getJobLog(long id, Handler<AsyncResult<JsonArray>> handler) {
client.lrange(RedisHelper.getKey("job:" + id + ":log"), 0, -1, handler);
return this;
}
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static io.vertx.redis.RedisClient lrange(io.vertx.redis.RedisClient j_receiver, java.lang.String key, long from, long to, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<Object>>> handler) {
io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.lrange(key,
from,
to,
handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray>>() {
public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray> ar) {
handler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonArray(event)));
}
} : null));
return j_receiver;
}
public static io.vertx.redis.RedisClient mget(io.vertx.redis.RedisClient j_receiver, java.lang.String key, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<Object>>> handler) {
代码示例来源:origin: org.swisspush/redisques
private void getQueueItems(Message<JsonObject> event) {
String keyListRange = getQueuesPrefix() + event.body().getJsonObject(PAYLOAD).getString(QUEUENAME);
int maxQueueItemCountIndex = getMaxQueueItemCountIndex(event.body().getJsonObject(PAYLOAD).getString(LIMIT));
redisClient.llen(keyListRange, countReply -> {
Long queueItemCount = countReply.result();
if (countReply.succeeded() && queueItemCount != null) {
redisClient.lrange(keyListRange, 0, maxQueueItemCountIndex, new GetQueueItemsHandler(event, queueItemCount));
} else {
log.warn("Operation getQueueItems failed. But I'll not notify my caller :) _5e51764bf36c19a781_", countReply.cause());
// IMO we should 'event.fail(countReply.cause())' here. But we don't, to keep backward compatibility.
}
});
}
内容来源于网络,如有侵权,请联系作者删除!