简体   繁体   English

如何在没有显式客户端的情况下使用Hazelcast 3.5配置NearCache

[英]How to configure NearCache with Hazelcast 3.5 without an explicit Client

Based on this question , I'm trying to switch to the version 3.5-EA of Hibernate. 基于这个问题 ,我试图切换到Hibernate的3.5-EA版本。

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);

But now the setNearCacheConfig method is gone. 但是现在setNearCacheConfig方法不见了。 There only exists a addNearCacheConfig on the ClientCacheConfig . ClientCacheConfig上仅存在一个addNearCacheConfig But I don't have a ClientCacheConfig . 但是我没有ClientCacheConfig

I basically don't know where to put the NearCacheConfig . 我基本上不知道将NearCacheConfig放在NearCacheConfig

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 - 如果您不想使用xml进行配置( http://docs.hazelcast.org/docs/latest/manual/html-single/hazelcast-documentation.html#near-cache ),则可以执行以下操作-

    Config cfg = new Config();
    MapConfig mc = new MapConfig();
    mc.setNearCacheConfig(new NearCacheConfig());
    cfg.addMapConfig(mc);
    HazelcastInstance hi = Hazelcast.newHazelcastInstance(cfg);

As per my opinion, NearCache feature is useful when you are using Client-Server hazelcast api and when youa re trying to access cache externally, but if you are gonna make call within hazelcast cluster internally and do not want to use Hazelcast client api than there no need to use NearCache feature. 根据我的观点,当您使用Client-Server hazelcast api并尝试从外部访问缓存时,NearCache功能很有用,但是如果您要在hazelcast集群内部进行调用并且不想使用Hazelcast客户端api,无需使用NearCache功能。 Since there will not be any benefit out of it. 既然不会有任何好处。

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

相关问题 您如何以编程方式为多播发现机制配置hazelcast? - How do you programmatically configure hazelcast for the multicast discovery mechanism? 如何在without主文件清单文件中没有节点输入的情况下配置p客户端? - How to Configure puppet client without node entry in the puppet master's manifest file? 如何在生产中配置WCF客户端? - How do you configure a WCF client in production? 如何配置 Spring 引导 Kafka 客户端使其不尝试连接 - How to configure Spring Boot Kafka client so it does not try to connect 如何在没有XML文件的情况下配置Spring ACL - How to configure Spring ACL without XML file 服务器离线时会话持久性Hazelcast客户端初始化 - Session Persistence Hazelcast client initialization when server is offline 无法配置Python 3.5以在Windows上使用Visual C ++编译器 - Cannot configure Python 3.5 to use Visual C++ compiler on Windows 如何在没有persistence.xml的情况下配置Spring? - How to configure Spring without persistence.xml? 如何配置apache,以便网站可以使用和不使用www前缀 - How to configure apache so that the website works with and without www prefix 处理配置而不定义显式类型对象 - Handling configurations without defining explicit type objects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM