DATAREDIS-1031 - Fix reactive pExpire/pExpireAt to invoke correct command.

We now invoke the correct PEXPIRE(AT) command. Previously, we invoked EXPIRE/EXPIREAT commands resulting in the wrong command being called.

Original Pull Request: #474
This commit is contained in:
Mark Paluch
2019-09-02 15:50:59 +02:00
committed by Christoph Strobl
parent 1c48021cea
commit 1ae1acf98f
3 changed files with 10 additions and 10 deletions

View File

@@ -131,7 +131,7 @@ public interface ReactiveKeyCommands {
* Find all keys matching the given {@literal pattern}.<br />
* It is recommended to use {@link #scan(ScanOptions)} to iterate over the keyspace as {@link #keys(Publisher)} is a
* non-interruptible and expensive Redis operation.
*
*
* @param patterns must not be {@literal null}.
* @return
* @see <a href="https://redis.io/commands/keys">Redis Documentation: KEYS</a>
@@ -462,7 +462,7 @@ public interface ReactiveKeyCommands {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(timeout, "Timeout must not be null!");
return expire(Mono.just(new ExpireCommand(key, timeout))).next().map(BooleanResponse::getOutput);
return pExpire(Mono.just(new ExpireCommand(key, timeout))).next().map(BooleanResponse::getOutput);
}
/**

View File

@@ -262,7 +262,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getTimeout(), "Timeout must not be null!");
return cmd.pexpire(command.getKey(), command.getTimeout().getSeconds())
return cmd.pexpire(command.getKey(), command.getTimeout().toMillis())
.map(value -> new BooleanResponse<>(command, value));
}));
}
@@ -294,7 +294,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getExpireAt(), "Expire at must not be null!");
return cmd.expireat(command.getKey(), command.getExpireAt().toEpochMilli())
return cmd.pexpireat(command.getKey(), command.getExpireAt().toEpochMilli())
.map(value -> new BooleanResponse<>(command, value));
}));
}