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

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

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

RedisClient.hmset介绍

[英]Set multiple hash fields to multiple values
[中]将多个哈希字段设置为多个值

代码示例

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

  1. /**
  2. * Set multiple hash fields to multiple values
  3. * @param key Key string
  4. * @param values Map of field:value pairs
  5. * @param handler Handler for the result of this call.
  6. * @return
  7. */
  8. public io.vertx.rxjava.redis.RedisClient hmset(String key, JsonObject values, Handler<AsyncResult<String>> handler) {
  9. delegate.hmset(key, values, handler);
  10. return this;
  11. }

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

  1. /**
  2. * Set multiple hash fields to multiple values
  3. * @param key Key string
  4. * @param values Map of field:value pairs
  5. * @param handler Handler for the result of this call.
  6. * @return
  7. */
  8. public io.vertx.rxjava.redis.RedisClient hmset(String key, JsonObject values, Handler<AsyncResult<String>> handler) {
  9. delegate.hmset(key, values, handler);
  10. return this;
  11. }

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

  1. public static io.vertx.redis.RedisClient hmset(io.vertx.redis.RedisClient j_receiver, java.lang.String key, java.util.Map<String, Object> values, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>> handler) {
  2. io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.hmset(key,
  3. values != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(values) : null,
  4. handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>() {
  5. public void handle(io.vertx.core.AsyncResult<java.lang.String> ar) {
  6. handler.handle(ar.map(event -> event));
  7. }
  8. } : null));
  9. return j_receiver;
  10. }
  11. public static io.vertx.redis.RedisClient hvals(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

  1. private void writeSomeConf(String key, Handler<AsyncResult<Void>> handler) {
  2. JsonObject conf = new JsonObject().put("some-key", "some-value");
  3. testRedisClient.hmset(key, conf, ar -> {
  4. if (ar.succeeded()) {
  5. handler.handle(Future.succeededFuture());
  6. } else {
  7. handler.handle(Future.failedFuture(ar.cause()));
  8. }
  9. });
  10. }

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

  1. private void writeSomeConf(String key, Handler<AsyncResult<Void>> handler) {
  2. JsonObject conf = new JsonObject().put("some-key", "some-value");
  3. testRedisClient.hmset(key, conf, ar -> {
  4. if (ar.succeeded()) {
  5. handler.handle(Future.succeededFuture());
  6. } else {
  7. handler.handle(Future.failedFuture(ar.cause()));
  8. }
  9. });
  10. }

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

  1. private void putLock(Message<JsonObject> event) {
  2. JsonObject lockInfo = extractLockInfo(event.body().getJsonObject(PAYLOAD).getString(REQUESTED_BY));
  3. if (lockInfo != null) {
  4. JsonArray lockNames = new JsonArray().add(event.body().getJsonObject(PAYLOAD).getString(QUEUENAME));
  5. if(!jsonArrayContainsStringsOnly(lockNames)){
  6. event.reply(createErrorReply().put(ERROR_TYPE, BAD_INPUT).put(MESSAGE, "Lock must be a string value"));
  7. return;
  8. }
  9. redisClient.hmset(getLocksKey(), buildLocksItems(lockNames, lockInfo), new PutLockHandler(event));
  10. } else {
  11. event.reply(createErrorReply().put(MESSAGE, "Property '" + REQUESTED_BY + "' missing"));
  12. }
  13. }

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

  1. private void lockedEnqueue(Message<JsonObject> event) {
  2. log.debug("RedisQues about to lockedEnqueue");
  3. JsonObject lockInfo = extractLockInfo(event.body().getJsonObject(PAYLOAD).getString(REQUESTED_BY));
  4. if (lockInfo != null) {
  5. redisClient.hmset(getLocksKey(), new JsonObject().put(event.body().getJsonObject(PAYLOAD).getString(QUEUENAME), lockInfo.encode()),
  6. putLockResult -> {
  7. if (putLockResult.succeeded()) {
  8. log.debug("RedisQues lockedEnqueue locking successful, now going to enqueue");
  9. enqueue(event);
  10. } else {
  11. log.warn("RedisQues lockedEnqueue locking failed. Skip enqueue");
  12. event.reply(createErrorReply());
  13. }
  14. });
  15. } else {
  16. log.warn("RedisQues lockedEnqueue failed because property '" + REQUESTED_BY + "' was missing");
  17. event.reply(createErrorReply().put(MESSAGE, "Property '" + REQUESTED_BY + "' missing"));
  18. }
  19. }

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

  1. /**
  2. * Save the job to the backend.
  3. */
  4. public Future<Job> save() {
  5. // check
  6. Objects.requireNonNull(this.type, "Job type cannot be null");
  7. if (this.id > 0)
  8. return update();
  9. Future<Job> future = Future.future();
  10. // generate id
  11. client.incr(RedisHelper.getKey("ids"), res -> {
  12. if (res.succeeded()) {
  13. this.id = res.result();
  14. this.zid = RedisHelper.createFIFO(id);
  15. String key = RedisHelper.getKey("job:" + this.id);
  16. // need subscribe
  17. if (this.delay > 0) {
  18. this.state = JobState.DELAYED;
  19. }
  20. client.sadd(RedisHelper.getKey("job:types"), this.type, _failure());
  21. this.created_at = System.currentTimeMillis();
  22. this.promote_at = this.created_at + this.delay;
  23. // save job
  24. client.hmset(key, this.toJson(), _completer(future, this));
  25. } else {
  26. future.fail(res.cause());
  27. }
  28. });
  29. return future.compose(Job::update);
  30. }

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

  1. private void bulkPutLocks(Message<JsonObject> event) {
  2. JsonArray locks = event.body().getJsonObject(PAYLOAD).getJsonArray(LOCKS);
  3. if (locks == null || locks.isEmpty()) {
  4. event.reply(createErrorReply().put(MESSAGE, "No locks to put provided"));
  5. return;
  6. }
  7. JsonObject lockInfo = extractLockInfo(event.body().getJsonObject(PAYLOAD).getString(REQUESTED_BY));
  8. if (lockInfo == null) {
  9. event.reply(createErrorReply().put(MESSAGE, "Property '" + REQUESTED_BY + "' missing"));
  10. return;
  11. }
  12. if(!jsonArrayContainsStringsOnly(locks)){
  13. event.reply(createErrorReply().put(ERROR_TYPE, BAD_INPUT).put(MESSAGE, "Locks must be string values"));
  14. return;
  15. }
  16. redisClient.hmset(getLocksKey(), buildLocksItems(locks, lockInfo), new PutLockHandler(event));
  17. }

相关文章

RedisClient类方法