Spring webflux中的缓存
Posted
技术标签:
【中文标题】Spring webflux中的缓存【英文标题】:Cacheing in Spring webflux 【发布时间】:2020-08-09 10:36:43 【问题描述】:很惊讶在网上很难找到关于这个的具体信息。
spring webflux可以缓存结果吗?
例如:我可以有我的rest服务,然后使用mongodb作为主数据库,redis作为缓存。所以当请求通过时,它会检查缓存,然后如果请求的结果不在缓存中,它会查询 mongodb?
如果您有链接等,只需将它们作为评论,我会阅读它们并自己回答问题。
谢谢。
【问题讨论】:
这能回答你的问题吗? Spring Webflux and @Cacheable - proper way of caching result of Mono / Flux type 【参考方案1】:实际上有一种使用 spring CacheMono
的正确方法,请参阅 https://medium.com/swlh/spring-distributed-cache-with-hazelcast-cfe0f6ad231 获取 Hazelcast 教程,但它很容易翻译成 Guava 或其他东西。
【讨论】:
以上是关于Spring webflux中的缓存的主要内容,如果未能解决你的问题,请参考以下文章
使用 spring webflux 替代 @Cacheable
1 个 Spring Boot 应用程序中的 Spring mvc 和 webflux
Spring Webflux Security 中的角色层次结构
RouterFunction 中的 Spring Webflux 错误处理