LOGGER.warning("The element <max-size/> for <near-cache/> is deprecated, please use <eviction/> instead!"); } else if ("time-to-live-seconds".equals(nodeName)) { nearCacheConfig.setTimeToLiveSeconds(Integer.parseInt(value)); } else if ("max-idle-seconds".equals(nodeName)) { nearCacheConfig.setMaxIdleSeconds(Integer.parseInt(value));
LOGGER.warning("The element <max-size/> for <near-cache/> is deprecated, please use <eviction/> instead!"); } else if ("time-to-live-seconds".equals(nodeName)) { nearCacheConfig.setTimeToLiveSeconds(Integer.parseInt(value)); } else if ("max-idle-seconds".equals(nodeName)) { nearCacheConfig.setMaxIdleSeconds(Integer.parseInt(value));
LOGGER.warning("The element <max-size/> for <near-cache/> is deprecated, please use <eviction/> instead!"); } else if ("time-to-live-seconds".equals(nodeName)) { nearCacheConfig.setTimeToLiveSeconds(Integer.parseInt(value)); } else if ("max-idle-seconds".equals(nodeName)) { nearCacheConfig.setMaxIdleSeconds(Integer.parseInt(value));
LOGGER.warning("The element <max-size/> for <near-cache/> is deprecated, please use <eviction/> instead!"); } else if ("time-to-live-seconds".equals(nodeName)) { nearCacheConfig.setTimeToLiveSeconds(Integer.parseInt(value)); } else if ("max-idle-seconds".equals(nodeName)) { nearCacheConfig.setMaxIdleSeconds(Integer.parseInt(value));
nearCacheConfig.setTimeToLiveSeconds(Math.max(1, nearCacheTtl)); nearCacheConfig.setTimeToLiveSeconds(timeToLiveSeconds);
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; }
cacheMapNLConfig.setInvalidateOnChange(true); cacheMapNLConfig.setMaxIdleSeconds(10 * 60); /* 10 minute idle time */ cacheMapNLConfig.setTimeToLiveSeconds(1 * 60 * 60); /* 1 hour TTL */ cacheMapConfig.setNearCacheConfig(cacheMapNLConfig); config.addMapConfig(cacheMapConfig);
public void run() { NearCacheConfig nearCacheConfig = createNearCacheConfig() .setInMemoryFormat(InMemoryFormat.OBJECT) .setCacheLocalEntries(true) .setInvalidateOnChange(false) .setTimeToLiveSeconds(TIME_TO_LIVE_SECONDS) .setEvictionConfig(createEvictionConfigWithEntryCountPolicy(RECORD_COUNT * 2)); ICache<Integer, Article> cache = createCacheWithNearCache(nearCacheConfig); cache.put(1, new Article("foo")); printNearCacheStats(cache, "The put(1, article) call has no effect on the empty Near Cache"); cache.get(1); printNearCacheStats(cache, "The first get(1) call populates the Near Cache"); waitForExpirationTask(TIME_TO_LIVE_SECONDS); printNearCacheStats(cache, "We've waited for the time-to-live-seconds, so the Near Cache entry is expired."); cache.get(1); printNearCacheStats(cache, "The next get(1) call is fetching the value again from the cache"); HazelcastClient.shutdownAll(); Hazelcast.shutdownAll(); }
codeConfig.setName("codes"); NearCacheConfig codeCacheConfig = new NearCacheConfig(); codeCacheConfig.setTimeToLiveSeconds(60 * 60 * 1000); // 1 hour TTL codeCacheConfig.setMaxIdleSeconds(10 * 60 * 1000); // 10 minutes max idle seconds codeCacheConfig.setInMemoryFormat(InMemoryFormat.OBJECT); referenceConfig.setName("references"); NearCacheConfig referenceCacheConfig = new NearCacheConfig(); referenceCacheConfig.setTimeToLiveSeconds(60 * 60 * 1000); // 1 hour TTL referenceCacheConfig.setMaxIdleSeconds(10 * 60 * 1000); // 10 minutes max idle seconds referenceCacheConfig.setInMemoryFormat(InMemoryFormat.OBJECT);