我正在尝试编写可缓存的暂挂函数,我认为它无法正常工作。我正在:
@Cacheable("product-image")
suspend fun getProductImage(productId: String): String {
return productRetriever.getProductImage(productId).awaitSingle()
}
它似乎没有缓存信息。类已正确接线。以下代码似乎有效,但它产生Mono而不是String
@Cacheable("product-image")
suspend fun getProductImage(productId: String): Mono<String> {
return productRetriever.getProductImage(productId).cache()
}
我正在经历这个。似乎@Cacheable无法缓存暂挂函数。当我将函数更改为常规函数时,它起作用了Mono