本文整理了Java中io.vertx.redis.RedisClient.hset
方法的一些代码示例,展示了RedisClient.hset
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisClient.hset
方法的具体详情如下:
包路径:io.vertx.redis.RedisClient
类名称:RedisClient
方法名:hset
[英]Set the string value of a hash field
[中]设置散列字段的字符串值
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Set the string value of a hash field
* @param key Key string
* @param field Field name
* @param value New value
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient hset(String key, String field, String value, Handler<AsyncResult<Long>> handler) {
delegate.hset(key, field, value, handler);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Set the string value of a hash field
* @param key Key string
* @param field Field name
* @param value New value
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient hset(String key, String field, String value, Handler<AsyncResult<Long>> handler) {
delegate.hset(key, field, value, handler);
return this;
}
代码示例来源:origin: sczyh30/vertx-kue
/**
* Set a key with value in Redis.
*
* @param key property key
* @param value value
*/
public Future<Job> set(String key, String value) {
Future<Job> future = Future.future();
client.hset(RedisHelper.getKey("job:" + this.id), key, value, r -> {
if (r.succeeded())
future.complete(this);
else
future.fail(r.cause());
});
return future;
}
代码示例来源:origin: io.vertx/vertx-service-discovery-backend-redis
@Override
public void update(Record record, Handler<AsyncResult<Void>> resultHandler) {
Objects.requireNonNull(record.getRegistration(), "No registration id in the record");
redis.hset(key, record.getRegistration(), record.toJson().encode(), ar -> {
if (ar.succeeded()) {
resultHandler.handle(Future.succeededFuture());
} else {
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: vert-x3/vertx-service-discovery
@Override
public void update(Record record, Handler<AsyncResult<Void>> resultHandler) {
Objects.requireNonNull(record.getRegistration(), "No registration id in the record");
redis.hset(key, record.getRegistration(), record.toJson().encode(), ar -> {
if (ar.succeeded()) {
resultHandler.handle(Future.succeededFuture());
} else {
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: io.vertx/vertx-service-discovery-backend-redis
@Override
public void store(Record record, Handler<AsyncResult<Record>> resultHandler) {
if (record.getRegistration() != null) {
resultHandler.handle(Future.failedFuture("The record has already been registered"));
return;
}
String uuid = UUID.randomUUID().toString();
record.setRegistration(uuid);
redis.hset(key, uuid, record.toJson().encode(), ar -> {
if (ar.succeeded()) {
resultHandler.handle(Future.succeededFuture(record));
} else {
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: vert-x3/vertx-service-discovery
@Override
public void store(Record record, Handler<AsyncResult<Record>> resultHandler) {
if (record.getRegistration() != null) {
resultHandler.handle(Future.failedFuture("The record has already been registered"));
return;
}
String uuid = UUID.randomUUID().toString();
record.setRegistration(uuid);
redis.hset(key, uuid, record.toJson().encode(), ar -> {
if (ar.succeeded()) {
resultHandler.handle(Future.succeededFuture(record));
} else {
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: org.swisspush.gateleen/gateleen-hook
@Override
public Future<Void> storeQueueRequest(String queue, JsonObject queueRequest) {
Future<Void> future = Future.future();
if(StringUtils.isEmpty(queue)){
future.fail("Queue is not allowed to be empty");
return future;
}
if(queueRequest == null){
future.fail("Request is not allowed to be empty");
return future;
}
try {
String queueRequestStr = queueRequest.encode();
redisClient.hset(QUEUE_REQUESTS, queue, queueRequestStr, reply -> {
if(reply.failed()){
String message = "Failed to store request for queue '"+queue+"'. Cause: " + logCause(reply);
log.error(message);
future.fail(message);
} else {
future.complete();
}
});
} catch (DecodeException ex){
future.fail("Failed to decode request for queue '"+queue+"'");
return future;
}
return future;
}
内容来源于网络,如有侵权,请联系作者删除!