h1 = Hazelcast.newHazelcastInstance();
h2 = Hazelcast.newHazelcastInstance();
ClientConfig clientConfig = new ClientConfig();
NearCacheConfig basicConfigNoInvalidation = new NearCacheConfig();
basicConfigNoInvalidation.setInMemoryFormat(InMemoryFormat.OBJECT);
basicConfigNoInvalidation.setName(NEAR_CACHE_WITH_NO_INVALIDATION + "*");
basicConfigNoInvalidation.setInvalidateOnChange(false);
clientConfig.addNearCacheConfig(basicConfigNoInvalidation);
NearCacheConfig maxSizeConfig = new NearCacheConfig();
maxSizeConfig.setMaxSize(MAX_CACHE_SIZE);
maxSizeConfig.setInvalidateOnChange(false);
maxSizeConfig.setName(NEAR_CACHE_WITH_MAX_SIZE + "*");
clientConfig.addNearCacheConfig(maxSizeConfig);
NearCacheConfig ttlConfig = new NearCacheConfig();
ttlConfig.setName(NEAR_CACHE_WITH_TTL + "*");
ttlConfig.setInvalidateOnChange(false);
ttlConfig.setTimeToLiveSeconds(MAX_TTL_SECONDS);
clientConfig.addNearCacheConfig(ttlConfig);
NearCacheConfig idleConfig = new NearCacheConfig();
idleConfig.setName(NEAR_CACHE_WITH_IDLE + "*");
idleConfig.setInvalidateOnChange(false);
idleConfig.setMaxIdleSeconds(MAX_IDLE_SECONDS);
clientConfig.addNearCacheConfig(idleConfig);
NearCacheConfig invalidateConfig = new NearCacheConfig();
invalidateConfig.setName(NEAR_CACHE_WITH_INVALIDATION + "*");
invalidateConfig.setInvalidateOnChange(true);
clientConfig.addNearCacheConfig(invalidateConfig);
client = HazelcastClient.newHazelcastClient(clientConfig);
}