user3038404
user3038404

Reputation: 361

Cacheing in Spring webflux

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.

Upvotes: 3

Views: 3009

Answers (1)

petronius
petronius

Reputation: 489

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.

Upvotes: 1

Related Questions