0

How do we handle cache miss scenario using ReactiveRedisTemplate<String, String>? Also, need to log and treat any error from underlying Redis cache as cache miss.

please suggest.

Rayyan
  • 107
  • 12

1 Answers1

0

It's hard to say without a code example, but you can utilize the operator .switchIfEmpty(). You'll need to defer the Mono so it's lazy loaded and only evaluated after the Redis template returns something.

.switchIfEmpty(Mono.defer(() -> callMethodToFetchData());
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77