gpt4 book ai didi

java - ehcache RMI 配置到 spring

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:36:20 24 4
gpt4 key购买 nike

我正在尝试将使用 RMI 的缓存的创建从 ehcache.xml 文件移动到 Spring xml。只创建一个 EhCacheFactoryBean 不是问题,但是 RMICacheReplicatorFactory 定义应该/可以如何实现?这是它在 ehcache.xml 文件中的样子。

非常感谢,伊丹

<cache name="MyCache1"
maxElementsInMemory="1000"
eternal="false"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
timeToLiveSeconds="3000"
timeToIdleSeconds="3000"
memoryStoreEvictionPolicy="LFU">

<!-- RMI replication listener -->
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true,
replicatePutsViaCopy=true,
replicateUpdates=true,
replicateUpdatesViaCopy=true,
replicateRemovals=true" />

<!-- RMI Cache bootstrap -->
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
propertySeparator="," />
</cache>

最佳答案

使用 Spring 3 时有一个 cacheEventListeners类型属性 Set<CacheEventListener>对于 EhCacheFactoryBean (参见 https://jira.springsource.org/browse/SPR-6234)。使用 2.5 时,您可以扩展 EhCacheFactoryBean自己喜欢shown here .

关于java - ehcache RMI 配置到 spring,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7427208/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com