【发布时间】:2013-01-15 03:35:27
【问题描述】:
在此链接中:http://code.google.com/p/ehcache-spring-annotations/wiki/UsingCacheable 他们说:
When the above POJO is defined as a bean in a Spring IoC container, the bean instance can be made 'cacheable' by adding merely one line of XML configuration.
如果不使用缓存框架,我只需将 Weather 和 List 声明为静态,这样就可以处理缓存。
所以我的问题是,如果我只想缓存 Weather 和 List<Location>,那我为什么要缓存整个 DAO?
同样在幕后,注解@Cacheable 是否将Weather 和List<Location> 变成静态变量?
【问题讨论】:
-
"Weather 和 List as static" - 这些是类,你的意思是
*getWeather()` 和findLocations()static*"。另外你怎么看做点什么static可以帮到你吗?