![](/img/trans.png)
[英]Is there any way to configure disk store for terracotta BigMemory to remove all data store on service/cache manager start up?
[英]How to configure BigMemory for disk persistence?
我正在使用ehcache将数据持久保存在磁盘上,以便重新启动JVM。 由于数据非常大,因此我想尝试BigMemory Go产品。 但是在他们的文档中,我没有提到磁盘配置(最大大小,路径)。 使用ehcache,我的配置如下所示:
PersistentCacheManager persistentCacheManager =
newCacheManagerBuilder()
.with(persistence(new File("path_to_cache_dest"))
.withCache("myType"), newCacheConfigurationBuilder(String.class, String.class, newResourcePoolsBuilder()
.disk(2, MemoryUnit.GB, true))
.build(true);
BigMemory Go中的等效功能是什么? BigMemory中处理磁盘持久性的对象是什么? 代码示例会很棒。
BigMemory Go是基于Ehcache 2.x的商业产品。 因此,它与Ehcache 3.x无关,因为它使用不同的代码库和不同的API。
因此,您需要为磁盘持久性配置Ehcache 2.x,然后使用商业版本运行该配置,然后使用商业磁盘存储:
new CacheManager(new Configuration()
.cache(new CacheConfiguration("aCache", 10000)
.persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.LOCALRESTARTABLE))
.maxBytesLocalDisk(2, MemoryUnit.GB)
.timeToLiveSeconds(1000)
.timeToLiveSeconds(360))
.name("testDiskStoreSize")
.diskStore(new DiskStoreConfiguration().path("java.io.tmpdir/testDiskStoreSize")));
需要注意的是,上述仍将在开源的工作,如果你要替换Strategy.LOCALRESTARTABLE
与Strategy.LOCALTEMPSWAP
。 您只会失去防崩溃的可重启性,并使用其他磁盘存储模型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.