本文整理了Java中io.vertx.redis.RedisClient.incr
方法的一些代码示例,展示了RedisClient.incr
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisClient.incr
方法的具体详情如下:
包路径:io.vertx.redis.RedisClient
类名称:RedisClient
方法名:incr
[英]Increment the integer value of a key by one
[中]将键的整数值增加一
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Increment the integer value of a key by one
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient incr(String key, Handler<AsyncResult<Long>> handler) {
delegate.incr(key, handler);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Increment the integer value of a key by one
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public io.vertx.rxjava.redis.RedisClient incr(String key, Handler<AsyncResult<Long>> handler) {
delegate.incr(key, handler);
return this;
}
代码示例来源:origin: sczyh30/vertx-blueprint-microservice
@Override
public void addThenRetrieve(String key, Handler<AsyncResult<Long>> resultHandler) {
client.incr(COUNTER_PREFIX + key, ar -> {
if (ar.succeeded()) {
resultHandler.handle(Future.succeededFuture(ar.result()));
} else {
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: sczyh30/vertx-blueprint-microservice
@Override
public void retrieveThenAdd(String key, Handler<AsyncResult<Long>> resultHandler) {
client.incr(COUNTER_PREFIX + key, ar -> {
if (ar.succeeded()) {
resultHandler.handle(Future.succeededFuture(ar.result() - 1));
} else {
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!