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

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

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

RedisClient.hdel介绍

[英]Delete one or more hash fields
[中]删除一个或多个哈希字段

代码示例

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

/**
 * Delete one or more hash fields
 * @param key Key string
 * @param field Field name
 * @param handler Handler for the result of this call.
 * @return 
 */
public io.vertx.rxjava.redis.RedisClient hdel(String key, String field, Handler<AsyncResult<Long>> handler) { 
 delegate.hdel(key, field, handler);
 return this;
}

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

/**
 * Delete one or more hash fields
 * @param key Key string
 * @param field Field name
 * @param handler Handler for the result of this call.
 * @return 
 */
public io.vertx.rxjava.redis.RedisClient hdel(String key, String field, Handler<AsyncResult<Long>> handler) { 
 delegate.hdel(key, field, handler);
 return this;
}

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

@Override
public void remove(String uuid, Handler<AsyncResult<Record>> resultHandler) {
 Objects.requireNonNull(uuid, "No registration id in the record");
 redis.hget(key, uuid, ar -> {
  if (ar.succeeded()) {
   if (ar.result() != null) {
    redis.hdel(key, uuid, deletion -> {
     if (deletion.succeeded()) {
      resultHandler.handle(Future.succeededFuture(
        new Record(new JsonObject(ar.result()))));
     } else {
      resultHandler.handle(Future.failedFuture(deletion.cause()));
     }
    });
   } else {
    resultHandler.handle(Future.failedFuture("Record '" + uuid + "' not found"));
   }
  } else {
   resultHandler.handle(Future.failedFuture(ar.cause()));
  }
 });
}

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

@Override
public void remove(String uuid, Handler<AsyncResult<Record>> resultHandler) {
 Objects.requireNonNull(uuid, "No registration id in the record");
 redis.hget(key, uuid, ar -> {
  if (ar.succeeded()) {
   if (ar.result() != null) {
    redis.hdel(key, uuid, deletion -> {
     if (deletion.succeeded()) {
      resultHandler.handle(Future.succeededFuture(
        new Record(new JsonObject(ar.result()))));
     } else {
      resultHandler.handle(Future.failedFuture(deletion.cause()));
     }
    });
   } else {
    resultHandler.handle(Future.failedFuture("Record '" + uuid + "' not found"));
   }
  } else {
   resultHandler.handle(Future.failedFuture(ar.cause()));
  }
 });
}

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

@Override
public Future<Void> removeQueueRequest(String queue) {
  Future<Void> future = Future.future();
  if(StringUtils.isEmpty(queue)){
    future.fail("Queue is not allowed to be empty");
    return future;
  }
  redisClient.hdel(QUEUE_REQUESTS, queue, reply -> {
    if(reply.failed()){
      String message = "Failed to remove request for queue '"+queue+"'. Cause: " + logCause(reply);
      log.error(message);
      future.fail(message);
    } else {
      future.complete();
    }
  });
  return future;
}

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

private void deleteLock(Message<JsonObject> event) {
  String queueName = event.body().getJsonObject(PAYLOAD).getString(QUEUENAME);
  redisClient.exists(getQueuesPrefix() + queueName, event1 -> {
    if (event1.succeeded() && event1.result() != null && event1.result() == 1) {
      notifyConsumer(queueName);
    }
    redisClient.hdel(getLocksKey(), queueName, new DeleteLockHandler(event));
  });
}

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

private void deleteAllQueueItems(Message<JsonObject> event) {
  JsonObject payload = event.body().getJsonObject(PAYLOAD);
  boolean unlock = payload.getBoolean(UNLOCK, false);
  String queue = payload.getString(QUEUENAME);
  redisClient.del(buildQueueKey(queue), deleteReply -> {
    if (deleteReply.failed()) {
      log.warn("Failed to deleteAllQueueItems. But we'll continue anyway. _dfc641c96464_", deleteReply.cause());
      // May we should 'fail()' here. But:
      // 1st: We don't, to keep backward compatibility
      // 2nd: We don't, to may unlock below.
    }
    if (unlock) {
      redisClient.hdel(getLocksKey(), queue, unlockReply -> {
        if (unlockReply.failed()) {
          log.warn("Failed to unlock queue '{}'. Will continue anyway _d08ae0e0986587_.", queue, unlockReply.cause());
          // IMO we should 'fail()' here. But we don't, to keep backward compatibility.
        }
        replyResultGreaterThanZero(event, deleteReply);
      });
    } else {
      replyResultGreaterThanZero(event, deleteReply);
    }
  });
}

相关文章

RedisClient类方法