} else if ("local-update-policy".equals(nodeName)) { NearCacheConfig.LocalUpdatePolicy policy = NearCacheConfig.LocalUpdatePolicy.valueOf(value); nearCacheConfig.setLocalUpdatePolicy(policy); } else if ("eviction".equals(nodeName)) { nearCacheConfig.setEvictionConfig(getEvictionConfig(child, true));
} else if ("local-update-policy".equals(nodeName)) { NearCacheConfig.LocalUpdatePolicy policy = NearCacheConfig.LocalUpdatePolicy.valueOf(value); nearCacheConfig.setLocalUpdatePolicy(policy); } else if ("eviction".equals(nodeName)) { nearCacheConfig.setEvictionConfig(getEvictionConfig(child, true));
nearCacheConfig.setCacheLocalEntries(Boolean.parseBoolean(value)); } else if ("local-update-policy".equals(nodeName)) { nearCacheConfig.setLocalUpdatePolicy(NearCacheConfig.LocalUpdatePolicy.valueOf(value)); } else if ("eviction".equals(nodeName)) { nearCacheConfig.setEvictionConfig(getEvictionConfig(child));
nearCacheConfig.setCacheLocalEntries(Boolean.parseBoolean(value)); } else if ("local-update-policy".equals(nodeName)) { nearCacheConfig.setLocalUpdatePolicy(NearCacheConfig.LocalUpdatePolicy.valueOf(value)); } else if ("eviction".equals(nodeName)) { nearCacheConfig.setEvictionConfig(getEvictionConfig(child));
public NearCacheConfig asNearCacheConfig(SerializationService serializationService) { NearCacheConfig config = new NearCacheConfig(); config.setName(name); config.setInMemoryFormat(inMemoryFormat); config.setSerializeKeys(serializeKeys); config.setInvalidateOnChange(invalidateOnChange); config.setTimeToLiveSeconds(timeToLiveSeconds); config.setMaxIdleSeconds(maxIdleSeconds); config.setEvictionConfig(evictionConfigHolder.asEvictionConfg(serializationService)); config.setCacheLocalEntries(cacheLocalEntries); config.setLocalUpdatePolicy(LocalUpdatePolicy.valueOf(localUpdatePolicy)); config.setPreloaderConfig(preloaderConfig); return config; }
public NearCacheConfig asNearCacheConfig(SerializationService serializationService) { NearCacheConfig config = new NearCacheConfig(); config.setName(name); config.setInMemoryFormat(inMemoryFormat); config.setSerializeKeys(serializeKeys); config.setInvalidateOnChange(invalidateOnChange); config.setTimeToLiveSeconds(timeToLiveSeconds); config.setMaxIdleSeconds(maxIdleSeconds); config.setEvictionConfig(evictionConfigHolder.asEvictionConfg(serializationService)); config.setCacheLocalEntries(cacheLocalEntries); config.setLocalUpdatePolicy(LocalUpdatePolicy.valueOf(localUpdatePolicy)); config.setPreloaderConfig(preloaderConfig); return config; }
public void run() { NearCacheConfig nearCacheConfig = createNearCacheConfig() .setInMemoryFormat(InMemoryFormat.OBJECT) .setInvalidateOnChange(false) .setLocalUpdatePolicy(NearCacheConfig.LocalUpdatePolicy.CACHE) .setEvictionConfig(createEvictionConfigWithEntryCountPolicy(RECORD_COUNT * 2)); ICache<String, Article> cache1 = createCacheWithNearCache(nearCacheConfig); ICache<String, Article> cache2 = createCacheWithNearCache(nearCacheConfig); String key = generateKeyOwnedBy(getServerInstance()); cache1.put(key, new Article("foo")); printNearCacheStats(cache1, "The cache1.put(key, new Article(\"foo\")) call will populate the Near Cache of cache1, ..."); printNearCacheStats(cache2, "..., but has no effect on the Near Cache of cache2"); cache1.get(key); printNearCacheStats(cache1, "The first cache1.get(key) call be served by the Near Cache of cache1"); cache2.get(key); printNearCacheStats(cache2, "The first cache2.get(key) call populates the Near Cache of cache2"); cache1.put(key, new Article("bar")); printNearCacheStats(cache1, "The cache1.put(key, new Article(\"bar\") call will update the Near Cache of cache1, ..."); printNearCacheStats(cache2, "..., but has no effect on the Near Cache of cache2"); Article article1 = cache1.get(key); printNearCacheStats(cache1, "The second cache1.get(key) call will be served by the Near Cache of cache1"); Article article2 = cache2.get(key); printNearCacheStats(cache2, "The second cache2.get(key) call will be served by the Near Cache of cache2"); System.out.printf("The retrieved articles are not the same: %s vs. %s%n", article1.getName(), article2.getName()); HazelcastClient.shutdownAll(); Hazelcast.shutdownAll(); }