-
Hi Ben, I am looking for caffeine use in spring web flux which support only non blocking APIs. Does caffeine provides either async or reactive template to support spring web flux. Thank. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can use |
Beta Was this translation helpful? Give feedback.
-
You can integrate Caffeine caches with Spring WebFlux using reactor-addons utility classes CacheMono and CacheFlux. However, both have been deprecated and have been slated for removal in release 3.6.0. I recently wrote a replacement (in Kotlin) for both of those helper classes using a couple of different strategies:
I had some existing APIs that needed to retro-fitted so would need to untangle all the relevant bits but happy to share if anyone is interested.. |
Beta Was this translation helpful? Give feedback.
You can use
AsyncCache
and convert usingMono.fromFuture
andMono.toFuture
. Spring Cache does not have async support (spring-projects/spring-framework#17920), so you should use our apis directly.