簡體   English   中英

如何為磁盤持久性配置BigMemory?

[英]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.LOCALRESTARTABLEStrategy.LOCALTEMPSWAP 您只會失去防崩潰的可重啟性,並使用其他磁盤存儲模型。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM