3

Suprised it was so hard to find concrete info about this online.

Is it possible to cache results in spring webflux?

For eg: Could I have my rest service, and then use mongodb as the primary database, and redis as the cache. So when request comes through it checks the cache , and then if result of request isnt in cache it queries the mongodb?

If you have links etc just put them as a comment, and Il read them and answer the question myself.

Thanks.

user3038404
  • 331
  • 5
  • 14
  • Does this answer your question? [Spring Webflux and @Cacheable - proper way of caching result of Mono / Flux type](https://stackoverflow.com/questions/48156424/spring-webflux-and-cacheable-proper-way-of-caching-result-of-mono-flux-type) – Tarmo Apr 25 '20 at 20:49

1 Answers1

1

There is actually a proper way to do this using spring CacheMono, see https://medium.com/swlh/spring-distributed-cache-with-hazelcast-cfe0f6ad231 for a Hazelcast tutorial, but it's easily translatable to Guava or something else.

petronius
  • 451
  • 3
  • 11