首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

ehcache代码使用

2012-06-28 
ehcache代码应用CacheConfiguration fee new CacheConfiguration(fooCache, 100000).overflowToDisk(t

ehcache代码应用

 CacheConfiguration fee = new CacheConfiguration("fooCache", 100000)                .overflowToDisk(true)        .eternal(true)                      .diskPersistent(false)        .transactionalMode("LOCAL")  // Tx set programatically        .copyOnWrite(true)                              .copyOnRead(true)            .diskStorePath("D:/temp");           Configuration config = new Configuration();            FactoryConfiguration factoryConfigforpeerprovider = new FactoryConfiguration();      factoryConfigforpeerprovider.setClass("net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory");      factoryConfigforpeerprovider.setProperties("peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,multicastGroupPort=4446, timeToLive=32");            config.addCacheManagerPeerProviderFactory(factoryConfigforpeerprovider); // Configuration for PeerProvider           FactoryConfiguration factoryConfigforpeerlistener = new FactoryConfiguration();      factoryConfigforpeerlistener.setClass("net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory");      factoryConfigforpeerlistener.setProperties("port=40001,socketTimeoutMillis=20000");           config.addCacheManagerPeerListenerFactory(factoryConfigforpeerlistener);       FactoryConfiguration factoryConfig = new FactoryConfiguration();       factoryConfig.setClass("net.sf.ehcache.distribution.RMICacheReplicatorFactory");       factoryConfig.setProperties("replicateAsynchronously=true, replicatePuts=false, replicateUpdates=true, replicateUpdatesViaCopy=false, replicateRemovals=true");    //config.addCacheManagerEventListenerFactory(factoryConfig);//Configuration for Replicator            CacheManager manager = new CacheManager(config);      Cache testCache = new Cache(fee);           manager.addCache(testCache);
?

?

热点排行