ehcache集群配置成功,字符串可以缓存,为什么对象不可以缓存?

Radium 发布于 2013/10/19 15:13
阅读 1K+
收藏 0

【开源中国 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。

加载中
0
Radium
Radium
找到问题了,key是区分大小写的!
0
华兹格
华兹格
对象是否可序列化?
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部