本文整理了Java中io.vertx.redis.RedisClient.set
方法的一些代码示例,展示了RedisClient.set
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisClient.set
方法的具体详情如下:
包路径:io.vertx.redis.RedisClient
类名称:RedisClient
方法名:set
[英]Set the string value of a key
[中]设置键的字符串值
代码示例来源:origin: vert-x3/vertx-examples
@Override
public void start() throws Exception {
// If a config file is set, read the host and port.
String host = Vertx.currentContext().config().getString("host");
if (host == null) {
host = "127.0.0.1";
}
// Create the redis client
final RedisClient client = RedisClient.create(vertx,
new RedisOptions().setHost(host));
client.set("key", "value", r -> {
if (r.succeeded()) {
System.out.println("key stored");
client.get("key", s -> {
System.out.println("Retrieved value: " + s.result());
});
} else {
System.out.println("Connection or Operation Failed " + r.cause());
}
});
}
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Set the string value of a key
* @param key Key of which value to set
* @param value New value for the key
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient set(String key, String value, Handler<AsyncResult<Void>> handler) {
delegate.set(key, value, handler);
return this;
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Set the string value of a key
* @param key Key of which value to set
* @param value New value for the key
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient set(String key, String value, Handler<AsyncResult<Void>> handler) {
delegate.set(key, value, handler);
return this;
}
代码示例来源:origin: sczyh30/vertx-blueprint-microservice
@Override
public void reset(String key, Handler<AsyncResult<Void>> resultHandler) {
client.set(COUNTER_PREFIX + key, "0", ar -> {
if (ar.succeeded()) {
resultHandler.handle(Future.succeededFuture());
} else {
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
}
内容来源于网络,如有侵权,请联系作者删除!