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

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

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

RedisClient.lpush介绍

[英]Prepend one value to a list
[中]在列表前加一个值

代码示例

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

/**
 * Prepend one value to a list
 * @param key Key string
 * @param value Value to be added at the beginning of the list
 * @param handler Handler for the result of this call.
 * @return 
 */
public io.vertx.rxjava.redis.RedisClient lpush(String key, String value, Handler<AsyncResult<Long>> handler) { 
 delegate.lpush(key, value, handler);
 return this;
}

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

/**
 * Prepend one value to a list
 * @param key Key string
 * @param value Value to be added at the beginning of the list
 * @param handler Handler for the result of this call.
 * @return 
 */
public io.vertx.rxjava.redis.RedisClient lpush(String key, String value, Handler<AsyncResult<Long>> handler) { 
 delegate.lpush(key, value, handler);
 return this;
}

代码示例来源:origin: sczyh30/vertx-kue

/**
 * Get a job from Redis backend by priority.
 *
 * @return async result of job
 */
private Future<Optional<Job>> getJobFromBackend() {
 Future<Optional<Job>> future = Future.future();
 client.blpop(RedisHelper.getKey(this.type + ":jobs"), 0, r1 -> {
  if (r1.failed()) {
   client.lpush(RedisHelper.getKey(this.type + ":jobs"), "1", r2 -> {
    if (r2.failed())
     future.fail(r2.cause());
   });
  } else {
   this.zpop(RedisHelper.getKey("jobs:" + this.type + ":INACTIVE"))
    .compose(kue::getJob)
    .setHandler(r -> {
     if (r.succeeded()) {
      future.complete(r.result());
     } else
      future.fail(r.cause());
    });
  }
 });
 return future;
}

相关文章

RedisClient类方法