有人可以解释一下两者之间的区别吗
com.googlecode.ehcache.annotations.Cacheable
和
org.springframework.cache.annotation.Cacheable
如果我把第一个替换为第二个,会有什么效果?
我在使用 spring 编码的 Web 服务中使用了
@Cacheable
@Cacheable(value = "policyCache")
public ResponseEntity<ResponseVO> listById(@PathVariable(value = "id") )
通过使用 com.googlecode.ehcache.annotations.Cacheable,您可以立即依赖 ehCache 实现。
如果您使用 Spring 注解,如果您稍后想要更改缓存实现,则无需进行任何代码改编,因此我建议使用后者。