我已经在网上到处寻找上述问题的简单答案,但就是找不到。我的方法如下:
@Cacheable(cacheNames = "objects")
public List<Object> get() { .. }
我正在使用EhCache 2.10.0和Spring Framework 4.2.1,并且我可以看到此方法的以下输出:
Adding cacheable method 'get' with attribute: [CacheableOperation[public java.util.List com.example.DAO.get()] caches=[objects] | key='' ...
同样也适用于后期记录。
Computed cache key 'SimpleKey []' for operation ...
@Cacheable注解在这种情况下应该做什么?是将每个对象放入以hashCode为键的缓存中(如其他地方所提示)?还是将整个列表按照某些基于列表的hashCode直接放入缓存中?