如何使用Hazelcast 3.5配置NearCache,而不使用显式客户端 [英] How to configure NearCache with Hazelcast 3.5 without an explicit Client
问题描述
根据此问题,我尝试切换到Hibernate的3.5-EA版本。
Based on this question, I'm trying to switch to the version 3.5-EA of Hibernate.
到目前为止我有一个这样的配置:
Up to now I had a configuration like this:
CacheConfiguration<K, V> configuration = new CacheConfig<K, V>()
.setNearCacheConfig(new NearCacheConfig().setInMemoryFormat(InMemoryFormat.OBJECT))
.setExpiryPolicyFactory(createExpiryPolicyFactory(expiryDuration));
cache = cacheManager.createCache(cacheName, configuration);
但现在 setNearCacheConfig
在 ClientCacheConfig
上只存在一个 addNearCacheConfig
。但我没有 ClientCacheConfig
。
But now the setNearCacheConfig
method is gone. There only exists a addNearCacheConfig
on the ClientCacheConfig
. But I don't have a ClientCacheConfig
.
我基本上不知道放在 NearCacheConfig
。
推荐答案
如果你不想使用xml配置href =http://docs.hazelcast.org/docs/latest/manual/html-single/hazelcast-documentation.html#near-cache =nofollow> http://docs.hazelcast.org/docs /latest/manual/html-single/hazelcast-documentation.html#near-cache ) - 您可能会这样做 -
If you do not want to use xml for configuration (http://docs.hazelcast.org/docs/latest/manual/html-single/hazelcast-documentation.html#near-cache) - you could probably do something like this -
Config cfg = new Config();
MapConfig mc = new MapConfig();
mc.setNearCacheConfig(new NearCacheConfig());
cfg.addMapConfig(mc);
HazelcastInstance hi = Hazelcast.newHazelcastInstance(cfg);
这篇关于如何使用Hazelcast 3.5配置NearCache,而不使用显式客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!