DATAREDIS-779 - Emit false if a conditional ReactiveStringCommands.set(…) does not set a value.
We now emit false when SET XX/SET NX complete without setting the value because the condition was evaluated to not set the value. Previously, we did not emit a value as Redis responds null (nil). This behavior becomes visible through ReactiveValueOperations.set[ifPresent|ifAbsent](…) methods. This is a breaking change in the sense that changes the character of ReactiveValueOperations.set[ifPresent|ifAbsent](…) from an optionally emitted element to always emit. Reactive sequences that currently resume operation with .switchIfEmpty(…) will no longer utilize the fallback publisher. Original pull request: #317.
This commit is contained in:
committed by
Mark Paluch
parent
1f6790b100
commit
fe80804873
@@ -37,6 +37,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Jiahe Cai
|
||||
* @since 2.0
|
||||
*/
|
||||
class LettuceReactiveStringCommands implements ReactiveStringCommands {
|
||||
@@ -93,7 +94,9 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
|
||||
|
||||
Mono<String> mono = args != null ? cmd.set(command.getKey(), command.getValue(), args)
|
||||
: cmd.set(command.getKey(), command.getValue());
|
||||
return mono.map(LettuceConverters::stringToBoolean).map((value) -> new BooleanResponse<>(command, value));
|
||||
return mono.map(LettuceConverters::stringToBoolean)
|
||||
.map(value -> new BooleanResponse<>(command, value))
|
||||
.switchIfEmpty(Mono.just(new BooleanResponse<>(command, Boolean.FALSE)));
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user