设置StoreByValueJCache+;Hazelcast界面不工作

设置StoreByValueJCache+;Hazelcast界面不工作,hazelcast,jcache,Hazelcast,Jcache,我使用setStoreByValue(真/假)做了一些测试,我不理解其中的差异 当我使用引用存储时,我希望在缓存中存储30多个对象 CacheManager manager = Caching.getCachingProvider().getCacheManager(); MutableConfiguration<String, CaLpgDataCollectionDto<CaBigNumber>> configuration = new Mutab

我使用setStoreByValue(真/假)做了一些测试,我不理解其中的差异

当我使用引用存储时,我希望在缓存中存储30多个对象

     CacheManager manager = Caching.getCachingProvider().getCacheManager();
     MutableConfiguration<String, CaLpgDataCollectionDto<CaBigNumber>> configuration = new MutableConfiguration<String, CaLpgDataCollectionDto<CaBigNumber>>();
     configuration.setStoreByValue(false);
     Cache<String, CaLpgDataCollectionDto<CaBigNumber>> testCache = manager.createCache("testCache", configuration);

     //ICache is a Hazelcast interface that extends JCache, provides more functionality
     ICache<String, CaLpgDataCollectionDto<CaBigNumber>> icache = testCache.unwrap(ICache.class);

     List<CaLpgDataRowDto<CaBigNumber>> bigList = lpgDatasource.getDataRows();

     while (bigList.size() <= 5000000)
     {
        bigList.addAll(bigList);
     }

     lpgDatasource.setDataRows(bigList);

     System.out.println("Free memory before (bytes): " + Runtime.getRuntime().freeMemory());

     for (int i = 0; i < 30 ; i++)
     {
        icache.put("objectTest"+i, lpgDatasource);
     }
CacheManager=Caching.getCachingProvider().getCacheManager();
MutableConfiguration=新的MutableConfiguration();
配置.setStoreByValue(假);
Cache testCache=manager.createCache(“testCache”,配置);
//ICache是一个Hazelcast接口,它扩展了JCache,提供了更多功能
ICache-ICache=testCache.unwrap(ICache.class);
List bigList=lpgDatasource.getDataRows();

而(bigList.size()JSR107标准规定引用存储是可选功能(参见JSR107 1.1.1规范第9页)。您可以查询
CachingProvider
,以测试是否通过支持可选功能


Hazelcast主要用作分布式缓存,不支持按引用存储。键和值必须可序列化,才能在网络中在Hazelcast成员和客户端之间传输。此外,根据所选的类型,值可以存储为序列化Blob(默认选项为内存格式的
BINARY
)或作为反序列化对象,但即使在后一种情况下,值也是先序列化/反序列化的,因此它是原始值的克隆。

非常感谢您的澄清。您帮了我很多忙。