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

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

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

RedisClient.hgetall介绍

[英]Get all the fields and values in a hash
[中]获取散列中的所有字段和值

代码示例

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

/**
 * Get all the fields and values in a hash
 * @param key Key string
 * @param handler Handler for the result of this call.
 * @return 
 */
public io.vertx.rxjava.redis.RedisClient hgetall(String key, Handler<AsyncResult<JsonObject>> handler) { 
 delegate.hgetall(key, handler);
 return this;
}

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

/**
 * Get all the fields and values in a hash
 * @param key Key string
 * @param handler Handler for the result of this call.
 * @return 
 */
public io.vertx.rxjava.redis.RedisClient hgetall(String key, Handler<AsyncResult<JsonObject>> handler) { 
 delegate.hgetall(key, handler);
 return this;
}

代码示例来源:origin: cescoffier/vertx-workshop

@Override
public void get(String name, Handler<AsyncResult<JsonObject>> handler) {
 redis.hgetall(name, hgetall -> {
  // TODO to implement
 });
}

代码示例来源:origin: io.vertx/vertx-lang-groovy

public static io.vertx.redis.RedisClient hgetall(io.vertx.redis.RedisClient j_receiver, java.lang.String key, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> handler) {
 io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.hgetall(key,
  handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() {
  public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) {
   handler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event)));
  }
 } : null));
 return j_receiver;
}
public static io.vertx.redis.RedisClient hkeys(io.vertx.redis.RedisClient j_receiver, java.lang.String key, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<Object>>> handler) {

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

@Override
 public void get(Handler<AsyncResult<Buffer>> completionHandler) {
  redis.hgetall(field, ar -> {
   if (ar.failed()) {
    completionHandler.handle(Future.failedFuture(ar.cause()));
   } else {
    completionHandler.handle(ar.map(json -> Buffer.buffer(ar.result().encode())));
   }
  });
 }
}

代码示例来源:origin: io.vertx/vertx-config-redis

@Override
 public void get(Handler<AsyncResult<Buffer>> completionHandler) {
  redis.hgetall(field, ar -> {
   if (ar.failed()) {
    completionHandler.handle(Future.failedFuture(ar.cause()));
   } else {
    completionHandler.handle(ar.map(json -> Buffer.buffer(ar.result().encode())));
   }
  });
 }
}

代码示例来源:origin: io.vertx/vertx-service-discovery-backend-redis

@Override
public void getRecords(Handler<AsyncResult<List<Record>>> resultHandler) {
 redis.hgetall(key, ar -> {
  if (ar.succeeded()) {
   JsonObject entries = ar.result();
   resultHandler.handle(Future.succeededFuture(entries.fieldNames().stream()
     .map(key -> new Record(new JsonObject(entries.getString(key))))
     .collect(Collectors.toList())));
  } else {
   resultHandler.handle(Future.failedFuture(ar.cause()));
  }
 });
}

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

@Override
public void getRecords(Handler<AsyncResult<List<Record>>> resultHandler) {
 redis.hgetall(key, ar -> {
  if (ar.succeeded()) {
   JsonObject entries = ar.result();
   resultHandler.handle(Future.succeededFuture(entries.fieldNames().stream()
     .map(key -> new Record(new JsonObject(entries.getString(key))))
     .collect(Collectors.toList())));
  } else {
   resultHandler.handle(Future.failedFuture(ar.cause()));
  }
 });
}

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

@Override
public JobService getJob(long id, Handler<AsyncResult<Job>> handler) {
 String zid = RedisHelper.createFIFO(id);
 client.hgetall(RedisHelper.getKey("job:" + id), r -> {
  if (r.succeeded()) {
   try {
    if (!r.result().containsKey("id")) {
     handler.handle(Future.succeededFuture());
    } else {
     Job job = new Job(r.result());
     job.setId(id);
     job.setZid(zid);
     handler.handle(Future.succeededFuture(job));
    }
   } catch (Exception e) {
    e.printStackTrace();
    this.removeBadJob(id, "", null);
    handler.handle(Future.failedFuture(e));
   }
  } else {
   this.removeBadJob(id, "", null);
   handler.handle(Future.failedFuture(r.cause()));
  }
 });
 return this;
}

相关文章

RedisClient类方法