简体   繁体   English

如何为磁盘持久性配置BigMemory?

[英]How to configure BigMemory for disk persistence?

I'm using ehcache to persist data on the disk for JVM restarts. 我正在使用ehcache将数据持久保存在磁盘上,以便重新启动JVM。 Since the data is very big, I want to try the BigMemory Go product. 由于数据非常大,因此我想尝试BigMemory Go产品。 But in their documentation I did not find any mention of disk configuration (max size, path). 但是在他们的文档中,我没有提到磁盘配置(最大大小,路径)。 With ehcache my configuration look like this: 使用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);

What is the equivalent in BigMemory Go? BigMemory Go中的等效功能是什么? What is the object dealing with disk persistence in BigMemory? BigMemory中处理磁盘持久性的对象是什么? A code sample would be great. 代码示例会很棒。

BigMemory Go is a commercial product based on Ehcache 2.x. BigMemory Go是基于Ehcache 2.x的商业产品。 It is thus unrelated to Ehcache 3.x as it uses a different code base and different APIs. 因此,它与Ehcache 3.x无关,因为它使用不同的代码库和不同的API。

So you would need to configure Ehcache 2.x for disk persistence and then run that configuration with the commercial version which would then use the commercial disk store: 因此,您需要为磁盘持久性配置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")));

Note that the above would still work in open source if you were to replace Strategy.LOCALRESTARTABLE with Strategy.LOCALTEMPSWAP . 需要注意的是,上述仍将在开源的工作,如果你要替换Strategy.LOCALRESTARTABLEStrategy.LOCALTEMPSWAP You would only loose the crash proof restartability and use a different disk storage model. 您只会失去防崩溃的可重启性,并使用其他磁盘存储模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM