ehcache缓存同步有三种策略
其中一种就是rmi
具体配置如下:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//192.168.1.254:40000/UserCache" />
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=192.168.1.126,port=40000,socketTimeoutMillis=120000" />
但是用过的人都知道 :rmiUrls=//192.168.1.254:40000/UserCache 这样配置的话 岂不是每个需要缓存的对象类都要配置进来 这样是不是有点太繁琐了? 还是有什么简便的配置方法(针对rmi策略的)请高人指点一下! 不胜感激!
其中一种就是rmi
具体配置如下:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//192.168.1.254:40000/UserCache" />
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=192.168.1.126,port=40000,socketTimeoutMillis=120000" />
但是用过的人都知道 :rmiUrls=//192.168.1.254:40000/UserCache 这样配置的话 岂不是每个需要缓存的对象类都要配置进来 这样是不是有点太繁琐了? 还是有什么简便的配置方法(针对rmi策略的)请高人指点一下! 不胜感激!
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
multicastGroupPort=4446, timeToLive=32"
/>
用这种方式好像可以