Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<version>2.2.0.DATAREDIS-1031-SNAPSHOT</version>

<name>Spring Data Redis</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ default Mono<List<ByteBuffer>> keys(ByteBuffer pattern) {
* 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>
Expand Down Expand Up @@ -462,7 +462,7 @@ default Mono<Boolean> pExpire(ByteBuffer key, Duration timeout) {
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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public Flux<BooleanResponse<ExpireCommand>> pExpire(Publisher<ExpireCommand> com
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));
}));
}
Expand Down Expand Up @@ -294,7 +294,7 @@ public Flux<BooleanResponse<ExpireAtCommand>> pExpireAt(Publisher<ExpireAtComman
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));
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public void shouldExpireKeysCorrectly() {
assertThat(nativeCommands.ttl(KEY_1)).isGreaterThan(8L);
}

@Test // DATAREDIS-602
@Test // DATAREDIS-602, DATAREDIS-1031
public void shouldPreciseExpireKeysCorrectly() {

nativeCommands.set(KEY_1, VALUE_1);
Expand All @@ -288,10 +288,10 @@ public void shouldPreciseExpireKeysCorrectly() {
.expectComplete() //
.verify();

assertThat(nativeCommands.ttl(KEY_1)).isGreaterThan(8L);
assertThat(nativeCommands.ttl(KEY_1)).isGreaterThan(8).isLessThan(11);
}

@Test // DATAREDIS-602
@Test // DATAREDIS-602, DATAREDIS-1031
public void shouldExpireAtKeysCorrectly() {

nativeCommands.set(KEY_1, VALUE_1);
Expand All @@ -302,10 +302,10 @@ public void shouldExpireAtKeysCorrectly() {
.expectComplete() //
.verify();

assertThat(nativeCommands.ttl(KEY_1)).isGreaterThan(8L);
assertThat(nativeCommands.ttl(KEY_1)).isGreaterThan(8).isLessThan(11);
}

@Test // DATAREDIS-602
@Test // DATAREDIS-602, DATAREDIS-1031
public void shouldPreciseExpireAtKeysCorrectly() {

nativeCommands.set(KEY_1, VALUE_1);
Expand All @@ -316,7 +316,7 @@ public void shouldPreciseExpireAtKeysCorrectly() {
.expectComplete() //
.verify();

assertThat(nativeCommands.ttl(KEY_1)).isGreaterThan(8L);
assertThat(nativeCommands.ttl(KEY_1)).isGreaterThan(8).isLessThan(11);
}

@Test // DATAREDIS-602
Expand Down