Skip to content

Commit

Permalink
Align supplier invoking syntax in CacheMono (#267)
Browse files Browse the repository at this point in the history
This is a follow up to #266 using the same, better, syntax for
deferring the call to the `otherSupplier` without creating
unnecessary lambda.
  • Loading branch information
greg65236592 authored Dec 13, 2021
1 parent c5d2ea7 commit dc7db88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion reactor-extra/src/main/java/reactor/cache/CacheMono.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public static <KEY, VALUE> MonoCacheBuilderCacheMiss<KEY, VALUE> lookup(
Function<KEY, Mono<Signal<? extends VALUE>>> reader, KEY key) {
return otherSupplier -> writer -> Mono.defer(() ->
reader.apply(key)
.switchIfEmpty(Mono.defer(() -> otherSupplier.get())
.switchIfEmpty(Mono.defer(otherSupplier)
.materialize()
.flatMap(signal -> writer.apply(key, signal)
.then(Mono.just(signal))
Expand Down

0 comments on commit dc7db88

Please sign in to comment.