我正在使用 Hazelcast 3.7.4,并且我有精简版和非精简版成员(member)。
在我的精简版成员(member)上,我设置近缓存如下:
NearCacheConfig nearCacheConfig = new NearCacheConfig(0, cacheSize, EvictionPolicy.LRU.name(), 0, true, InMemoryFormat.OBJECT);
config.getMapConfig(mapName).setNearCacheConfig(nearCacheConfig);
我已经在我的精简版成员上配置了条目监听器,并且可以验证它是否在更改时被调用。而且,新旧值内容都是正确的。
但是当我尝试从 map 中获取值时,我仍然得到旧值。
在调试时,我尝试查看 map 内容,并且可以看到新值,但是当我调用: map.get(key)
时,会返回旧值。
最佳答案
这显然是一个错误,我从 HZ 团队得到的答案:
Thanks for reporting this, indeed it is a bug for 3.7 version. 3.8-EA don't have this issue. Root cause of the issue is invalidations are not sent to lite-members if near cache is not configured also on other members.
For now, as a workaround you can enable near cache on other members. Possibly we can fix this issue in next 3.7 patch release which will be 3.7.6.
作为一种解决方法,按照建议,我在其他成员上启用了近缓存(仅适用于这张 map ),它解决了问题。
关于java - Hazelcast 近缓存驱逐不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41789904/