I am trying to implement something like this Spring boot populating cache used by findById method with findAll method
but with R2DBC. However, it does not appear to work as I am returning a Mono.
@Cacheable("stores",key = "#storeId")
Mono<Store> findById(int storeId);
The way I determine it is looking at the general_log of the database and find that it's still performing the query
I'm not familiar with there being any fluent integration between the @Cacheable annotation and reactive frameworks. The primary issue is that there are no non-blocking cache implementations (JSR-107 cache API is blocking). Only Redis is providing a reactive driver. See Spring.io's reactive caching guide . I've read somewhere that you can still use the annotation on service methods, but that will "only" cache your wrapper objects, ie, Mono / Flux, but not the actual result of your findById..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.