Created
May 8, 2022 12:09
-
-
Save sirech/8709bea9d4080f479ed79255c7dd6369 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private T getFromCacheOrThrow(String key, RuntimeException exception) { | |
var value = cache.findById(key); | |
value.ifPresent((v) -> { | |
log.info(String.format("FallbackCache[%s] got cached value", cb.getName()), v); | |
}); | |
return value | |
.map(Cacheable::data) | |
.orElseThrow(() -> { | |
log.error( | |
String.format("FallbackCache[%s] got an error without a cached value", cb.getName()), | |
exception | |
); | |
throw exception; | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment