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

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

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

RedisClient.llen介绍

[英]Get the length of a list
[中]获取列表的长度

代码示例

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Get the length of a list
 * @param key String key
 * @param handler Handler for the result of this call.
 * @return 
 */
public io.vertx.rxjava.redis.RedisClient llen(String key, Handler<AsyncResult<Long>> handler) { 
 delegate.llen(key, handler);
 return this;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Get the length of a list
 * @param key String key
 * @param handler Handler for the result of this call.
 * @return 
 */
public io.vertx.rxjava.redis.RedisClient llen(String key, Handler<AsyncResult<Long>> handler) { 
 delegate.llen(key, handler);
 return this;
}

代码示例来源:origin: org.swisspush/gateleen-monitoring

/**
 * Reads the size from the last used Queue from redis and stores it to JMX
 *
 * @param queue the name of the queue the last update was made
 */
public void updateLastUsedQueueSizeInformation(final String queue) {
  log.trace("About to update last used Queue size counter");
  String queueName = QUEUES_KEY_PREFIX + ":" + queue;
  redisClient.llen(queueName, reply -> {
    if(reply.failed()){
      log.error("Error gathering queue size for queue '" + queue + "'");
    } else {
      final long count = reply.result();
      vertx.eventBus().publish(Address.monitoringAddress(), new JsonObject().put(METRIC_NAME, prefix + LAST_USED_QUEUE_SIZE_METRIC).put(METRIC_ACTION, "update").put("n", count));
    }
  });
}

代码示例来源:origin: org.swisspush/gateleen-monitoring

private void collectQueueLengths(final List<String> queueNames, final int numOfQueues, final boolean showEmptyQueues, final QueueLengthCollectingCallback callback) {
  final SortedMap<String, Long> resultMap = new TreeMap<>();
  final List<Map.Entry<String, Long>> mapEntryList = new ArrayList<>();
  final AtomicInteger subCommandCount = new AtomicInteger(queueNames.size());
  if (!queueNames.isEmpty()) {
    for (final String name : queueNames) {
      final String queueName = QUEUES_KEY_PREFIX + ":" + name;
      redisClient.llen(queueName, reply -> {
        subCommandCount.decrementAndGet();
        if(reply.failed()){
          log.error("Error gathering size of queue " + queueName);
        } else {
          final long count = reply.result();
          if (showEmptyQueues || count > 0) {
            resultMap.put(name, count);
          }
        }
        if (subCommandCount.get() == 0) {
          mapEntryList.addAll(resultMap.entrySet());
          sortResultMap(mapEntryList);
          int toIndex = numOfQueues > queueNames.size() ? queueNames.size() : numOfQueues;
          toIndex = Math.min(mapEntryList.size(), toIndex);
          callback.onDone(mapEntryList.subList(0, toIndex));
        }
      });
    }
  } else {
    callback.onDone(mapEntryList);
  }
}

代码示例来源: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.
    }
  });
}

代码示例来源:origin: org.swisspush/redisques

log.trace("RedisQues read queue: " + key);
redisClient.llen(key2, answer1 -> {
  if (answer1.succeeded() && answer1.result() != null && answer1.result() > 0) {
    notifyConsumer(queue);

代码示例来源:origin: org.swisspush/redisques

break;
case getQueueItemsCount:
  redisClient.llen(getQueuesPrefix() + body.getJsonObject(PAYLOAD).getString(QUEUENAME), new GetQueueItemsCountHandler(event));
  break;
case getQueuesCount:

相关文章

RedisClient类方法