【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”
ehcache使用自动发现的方式配置了集群,测试字符串缓存同步都正常,但是缓存的对象无法同步,这是为什么呢?
配置信息
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,multicastGroupPort=4446, timeToLive=0"/>
<!-- hostName不可配置为127.0.0.1 -->
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=localhost, port=40001,socketTimeoutMillis=2000"/>
A机器执行:
Element element1 = new Element("key", "A Server update");
cache.put(element1);
B机器可以根据key查询到正确的结果
A机器执行:
Dictionary dic = new Dictionary("A server update dictionary");
Element element1 = new Element("dictionary", dic );
cache.put(element1);
B机器没能更新缓存。对象类型不能进行集群吗?Dictionary已经继承Serializable,也写了serialVersionUID。