io.vertx.redis.RedisClient.lrange()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(265)

本文整理了Java中io.vertx.redis.RedisClient.lrange方法的一些代码示例,展示了RedisClient.lrange的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisClient.lrange方法的具体详情如下:
包路径:io.vertx.redis.RedisClient
类名称:RedisClient
方法名:lrange

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.
    }
  });
}

相关文章

RedisClient类方法