4

我们将 springmodules 方法缓存(Spring 2.0.7)与 ehcache 结合使用来缓存经常请求的数据,以便从数据库中获取负载。

例如,我们正在缓存 : 的方法结果,public Profile getUserProfile(User u) {...}当用户更新他自己的配置文件中的数据时,最好在更新后直接使缓存Profile仅针对该单曲无效User,以便更改立即反映在用户界面中。

有没有办法在不使该方法的完整缓存失效的情况下实现这一点?

或者对于这个用例,有没有比 springmodules-caching 更好的选择?

非常感谢任何提示。

4

1 回答 1

2

或者对于这个用例,有没有比 springmodules-caching 更好的选择?

使用 Spring 3.1 就有了这个新的缓存特性。

如何使 springmodules 方法缓存中的单个条目无效?来自Spring @CacheEvict3.1

3.1 的 Spring 参考对此有一个很好的章节:28.3 Declarative annotation-based caching

于 2012-03-22T09:23:58.677 回答