Migrating from EmbeddedCacheMangager to RemoteCacheManager
rjack2 Aug 26, 2016 8:49 AMFolks,
I migrating our Embedded Cache Manager to a Remote Cache Manager. I'm using Infinispan 8.2.4 final. The original code was 6.x?
Here is the original code:
public void configure(EmbeddedCacheManager manager) {
//@formatter:off
ConfigurationBuilder builder = new ConfigurationBuilder();
builder
.clustering().cacheMode(CacheMode.REPL_SYNC)
.invocationBatching().enable(true)
.persistence()
.passivation(false)
.addSingleFileStore()
.preload(true)
.shared(false)
.fetchPersistentState(true)
.ignoreModifications(false)
.purgeOnStartup(false)
.location(centralCachePath)
.eviction().strategy(EvictionStrategy.NONE)
.expiration().lifespan(-1L).maxIdle(-1L);
manager.defineConfiguration(IEcommerceConstants.CUSTOM_CACHE,
builder.build());
//@formatter:on
Here is my attempt at configuring the cache for a Remote Cache Manager:
<replicated-cache name="CustomCache" mode="SYNC" segments="20" owners="2" remote-timeout="30000" start="EAGER">
<transaction mode="BATCH"/>
<persistence passivation="false">
<!-- note that class is missing and is induced by the fileStore element name -->
<file-store
shared="false" preload="true"
fetch-state="true"
read-only="false"
purge="false"
path="${java.io.tmpdir}">
<write-behind flush-lock-timeout="15000" thread-pool-size="5" />
</file-store>
</persistence>
<eviction strategy="LIRS" max-entries="5000"/>
<!--Lifespan- 7 Days in ms -->
<expiration lifespan="604800000" interval="5000" />
</replicated-cache>
1) Is this correct?
2) I have to create several replicated caches, can I use replicated-cache-configuration to default most of the settings. Is this default automatic (i.e. inherited by all replicated caches)? And if I set a value in a replicated-cache will it be override a value set here?
<replicated-cache name"CustomCache" >
</replicated-cache>
<replicated-cache-configuration name="replicated" mode="SYNC"segments="20" owners="2" remote-timeout="30000" start="EAGER">
<transaction mode="BATCH"/>
<persistence passivation="false">
<!-- note that class is missing and is induced by the fileStore element name -->
<file-store
shared="false" preload="true"
fetch-state="true"
read-only="false"
purge="false"
path="${java.io.tmpdir}">
<write-behind flush-lock-timeout="15000" thread-pool-size="5" />
</file-store>
</persistence>
<eviction strategy="LIRS" max-entries="5000"/>
<!--Lifespan- 7 Days in ms -->
<expiration lifespan="604800000" interval="5000" />
</replicated-cache-configuration>
3) Can I just remove all the "distributed cache" tags since I'm not using distributed caches? I using "cluster.xml" as my base configuration file.
Regards,
Robert