Relative Content

Tag Archive for javaproject-reactorcaffeine-cache

How to store a Mono error in Async Caffeine Cache?

AsyncLoadingCache<String, String> cache = Caffeine.newBuilder().buildAsync( (String k, Executor e) -> doThingReturnsMono() .subscribeOn(Schedulers.fromExecutor(e)) .toFuture() ); cache.put(“fail”, Mono.error<String>(new RuntimeException()).toFuture()); cache.put(“success”, Mono.just(“success”).toFuture()); System.err.println(cache.asMap().getKeys()); // Prints [“success”] How can we put a Mono.error into an AsyncLoadingCache? java project-reactor caffeine-cache The async cache handles values coming in asynchronously, it does not store raw Futures/Monos. It instead stores the underlying data, […]