0
我使用Spring @Cacheable注解Hazelcast 2.1和 Spring 3.1。从Hazelcast中的Map中返回一个克隆的对象
@Cacheable("testCache")
public MyObject testMethod(int testParam);
//After method call
MyObject test = Hazelcast.getMap("testCache").get("key")
test.setSomeProp() //This line causes an update to the cache since it is reference.
是否有可能从地图,而不是参考从Hazelcast.getMap()返回缓存值的克隆/复制?
即我想要一个像EhCache中的copyOnRead功能。请参阅EhCache Documentation
Thanks @Fuad。这就是我确实需要的。我注意到,在你的答案后文档中有一部分关于“缓存值”,但它在另一章(Common Gotchas)中。在相关的章节中看到这种配置的东西真是太好了,以至于它们可以更容易找到 – emrahkocaman