【发布时间】:2020-09-30 05:48:33
【问题描述】:
我有两种方法,如下所示。一种用@CachePut 注释,另一种用@Cacheable 注释。它们都使用相同的键。根据其他帖子的一些答案,我认为@cacheput 替换了该值。如果是这种情况,如果文档中的某个字段有更新,是否会为相同的 id 执行带有 @Cacheable 注释的方法。
@CachePut(value="testcache",key="#document.id")
public Document update(Document document){
// code to update db
return document
}
@Cacheable(value="testcache")
public Document getDocument(String id){
// query database and fetch document
return document
}
【问题讨论】:
标签: spring-boot hazelcast spring-cache