我有这个infinispan.xml配置:
<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>如何使用缓存名配置DefaultCacheManager来实例化本地而不是默认缓存(dist-sync)
发布于 2020-07-06 16:59:14
就像这样:
DefaultCacheManager cacheManager = new DefaultCacheManager("infinispan.xml");
Cache<K, V> cache = cacheManager.getCache("local");文档中的更多信息:https://infinispan.org/docs/stable/titles/configuring/configuring.html#cache_modes
另外,DefaultCacheManager.getCache()返回default-cache属性(<cache-container default-cache="dist-sync">)中定义的名称的缓存。
https://stackoverflow.com/questions/62759262
复制相似问题