I have this infinispan.xml configuration:
<infinispan>
<cache-container default-cache="dist-sync">
<transport/>
<local-cache name="local">
<expiration lifespan="-1" max-idle="5000" />
</local-cache>
<invalidation-cache name="invalidation" mode="SYNC"/>
<replicated-cache name="repl-sync" mode="SYNC"/>
<distributed-cache name="dist-sync" mode="SYNC"/>
</cache-container>
</infinispan>
How can I instantiate DefaultCacheManager with the cache name configuration local instead of the default cache (dist-sync)
Something like this:
DefaultCacheManager cacheManager = new DefaultCacheManager("infinispan.xml");
Cache<K, V> cache = cacheManager.getCache("local");
More info in the documentation: https://infinispan.org/docs/stable/titles/configuring/configuring.html#cache_modes
As a side note, DefaultCacheManager.getCache()
returns the cache with name defined in the default-cache
attribute (<cache-container default-cache="dist-sync">
)