本文整理了Java中io.vertx.redis.RedisClient.hmset
方法的一些代码示例,展示了RedisClient.hmset
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisClient.hmset
方法的具体详情如下:
包路径:io.vertx.redis.RedisClient
类名称:RedisClient
方法名:hmset
[英]Set multiple hash fields to multiple values
[中]将多个哈希字段设置为多个值
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Set multiple hash fields to multiple values
* @param key Key string
* @param values Map of field:value pairs
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient hmset(String key, JsonObject values, Handler<AsyncResult<String>> handler) {
delegate.hmset(key, values, handler);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Set multiple hash fields to multiple values
* @param key Key string
* @param values Map of field:value pairs
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient hmset(String key, JsonObject values, Handler<AsyncResult<String>> handler) {
delegate.hmset(key, values, handler);
return this;
}
代码示例来源:origin: io.vertx/vertx-lang-groovy
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) {
io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.hmset(key,
values != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(values) : null,
handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>() {
public void handle(io.vertx.core.AsyncResult<java.lang.String> ar) {
handler.handle(ar.map(event -> event));
}
} : null));
return j_receiver;
}
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
private void writeSomeConf(String key, Handler<AsyncResult<Void>> handler) {
JsonObject conf = new JsonObject().put("some-key", "some-value");
testRedisClient.hmset(key, conf, ar -> {
if (ar.succeeded()) {
handler.handle(Future.succeededFuture());
} else {
handler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: io.vertx/vertx-config-redis
private void writeSomeConf(String key, Handler<AsyncResult<Void>> handler) {
JsonObject conf = new JsonObject().put("some-key", "some-value");
testRedisClient.hmset(key, conf, ar -> {
if (ar.succeeded()) {
handler.handle(Future.succeededFuture());
} else {
handler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: org.swisspush/redisques
private void putLock(Message<JsonObject> event) {
JsonObject lockInfo = extractLockInfo(event.body().getJsonObject(PAYLOAD).getString(REQUESTED_BY));
if (lockInfo != null) {
JsonArray lockNames = new JsonArray().add(event.body().getJsonObject(PAYLOAD).getString(QUEUENAME));
if(!jsonArrayContainsStringsOnly(lockNames)){
event.reply(createErrorReply().put(ERROR_TYPE, BAD_INPUT).put(MESSAGE, "Lock must be a string value"));
return;
}
redisClient.hmset(getLocksKey(), buildLocksItems(lockNames, lockInfo), new PutLockHandler(event));
} else {
event.reply(createErrorReply().put(MESSAGE, "Property '" + REQUESTED_BY + "' missing"));
}
}
代码示例来源:origin: org.swisspush/redisques
private void lockedEnqueue(Message<JsonObject> event) {
log.debug("RedisQues about to lockedEnqueue");
JsonObject lockInfo = extractLockInfo(event.body().getJsonObject(PAYLOAD).getString(REQUESTED_BY));
if (lockInfo != null) {
redisClient.hmset(getLocksKey(), new JsonObject().put(event.body().getJsonObject(PAYLOAD).getString(QUEUENAME), lockInfo.encode()),
putLockResult -> {
if (putLockResult.succeeded()) {
log.debug("RedisQues lockedEnqueue locking successful, now going to enqueue");
enqueue(event);
} else {
log.warn("RedisQues lockedEnqueue locking failed. Skip enqueue");
event.reply(createErrorReply());
}
});
} else {
log.warn("RedisQues lockedEnqueue failed because property '" + REQUESTED_BY + "' was missing");
event.reply(createErrorReply().put(MESSAGE, "Property '" + REQUESTED_BY + "' missing"));
}
}
代码示例来源:origin: sczyh30/vertx-kue
/**
* Save the job to the backend.
*/
public Future<Job> save() {
// check
Objects.requireNonNull(this.type, "Job type cannot be null");
if (this.id > 0)
return update();
Future<Job> future = Future.future();
// generate id
client.incr(RedisHelper.getKey("ids"), res -> {
if (res.succeeded()) {
this.id = res.result();
this.zid = RedisHelper.createFIFO(id);
String key = RedisHelper.getKey("job:" + this.id);
// need subscribe
if (this.delay > 0) {
this.state = JobState.DELAYED;
}
client.sadd(RedisHelper.getKey("job:types"), this.type, _failure());
this.created_at = System.currentTimeMillis();
this.promote_at = this.created_at + this.delay;
// save job
client.hmset(key, this.toJson(), _completer(future, this));
} else {
future.fail(res.cause());
}
});
return future.compose(Job::update);
}
代码示例来源:origin: org.swisspush/redisques
private void bulkPutLocks(Message<JsonObject> event) {
JsonArray locks = event.body().getJsonObject(PAYLOAD).getJsonArray(LOCKS);
if (locks == null || locks.isEmpty()) {
event.reply(createErrorReply().put(MESSAGE, "No locks to put provided"));
return;
}
JsonObject lockInfo = extractLockInfo(event.body().getJsonObject(PAYLOAD).getString(REQUESTED_BY));
if (lockInfo == null) {
event.reply(createErrorReply().put(MESSAGE, "Property '" + REQUESTED_BY + "' missing"));
return;
}
if(!jsonArrayContainsStringsOnly(locks)){
event.reply(createErrorReply().put(ERROR_TYPE, BAD_INPUT).put(MESSAGE, "Locks must be string values"));
return;
}
redisClient.hmset(getLocksKey(), buildLocksItems(locks, lockInfo), new PutLockHandler(event));
}
内容来源于网络,如有侵权,请联系作者删除!