private ScheduledFuture createAndScheduleExpirationTask() { if (nearCacheConfig.getMaxIdleSeconds() > 0L || nearCacheConfig.getTimeToLiveSeconds() > 0L) { ExpirationTask expirationTask = new ExpirationTask(); return expirationTask.schedule(scheduler); } return null; }
private ScheduledFuture createAndScheduleExpirationTask() { if (nearCacheConfig.getMaxIdleSeconds() > 0L || nearCacheConfig.getTimeToLiveSeconds() > 0L) { ExpirationTask expirationTask = new ExpirationTask(); return expirationTask.schedule(scheduler); } return null; }
protected AbstractNearCacheRecordStore(NearCacheConfig nearCacheConfig, NearCacheStatsImpl nearCacheStats, SerializationService serializationService, ClassLoader classLoader) { this.nearCacheConfig = nearCacheConfig; this.timeToLiveMillis = nearCacheConfig.getTimeToLiveSeconds() * MILLI_SECONDS_IN_A_SECOND; this.maxIdleMillis = nearCacheConfig.getMaxIdleSeconds() * MILLI_SECONDS_IN_A_SECOND; this.serializationService = serializationService; this.classLoader = classLoader; this.nearCacheStats = nearCacheStats; this.evictionDisabled = nearCacheConfig.getEvictionConfig().getEvictionPolicy() == EvictionPolicy.NONE; }
protected AbstractNearCacheRecordStore(NearCacheConfig nearCacheConfig, NearCacheStatsImpl nearCacheStats, SerializationService serializationService, ClassLoader classLoader) { this.nearCacheConfig = nearCacheConfig; this.inMemoryFormat = nearCacheConfig.getInMemoryFormat(); this.timeToLiveMillis = nearCacheConfig.getTimeToLiveSeconds() * MILLI_SECONDS_IN_A_SECOND; this.maxIdleMillis = nearCacheConfig.getMaxIdleSeconds() * MILLI_SECONDS_IN_A_SECOND; this.serializationService = serializationService; this.classLoader = classLoader; this.nearCacheStats = nearCacheStats; this.evictionDisabled = nearCacheConfig.getEvictionConfig().getEvictionPolicy() == EvictionPolicy.NONE; }
public static NearCacheConfigHolder of(NearCacheConfig config, SerializationService serializationService) { if (config == null) { return null; } return new NearCacheConfigHolder(config.getName(), config.getInMemoryFormat().name(), config.isSerializeKeys(), config.isInvalidateOnChange(), config.getTimeToLiveSeconds(), config.getMaxIdleSeconds(), EvictionConfigHolder.of(config.getEvictionConfig(), serializationService), config.isCacheLocalEntries(), config.getLocalUpdatePolicy().name(), config.getPreloaderConfig()); } }
public static NearCacheConfigHolder of(NearCacheConfig config, SerializationService serializationService) { if (config == null) { return null; } return new NearCacheConfigHolder(config.getName(), config.getInMemoryFormat().name(), config.isSerializeKeys(), config.isInvalidateOnChange(), config.getTimeToLiveSeconds(), config.getMaxIdleSeconds(), EvictionConfigHolder.of(config.getEvictionConfig(), serializationService), config.isCacheLocalEntries(), config.getLocalUpdatePolicy().name(), config.getPreloaderConfig()); } }
@SuppressWarnings("deprecation") private static void mapNearCacheConfigXmlGenerator(XmlGenerator gen, NearCacheConfig n) { if (n != null) { if (n.getName() != null) { gen.open("near-cache", "name", n.getName()); } else { gen.open("near-cache"); } gen.node("in-memory-format", n.getInMemoryFormat()) .node("invalidate-on-change", n.isInvalidateOnChange()) .node("time-to-live-seconds", n.getTimeToLiveSeconds()) .node("max-idle-seconds", n.getMaxIdleSeconds()) .node("serialize-keys", n.isSerializeKeys()) .node("cache-local-entries", n.isCacheLocalEntries()) .node("max-size", n.getMaxSize()) .node("eviction-policy", n.getEvictionPolicy()); evictionConfigXmlGenerator(gen, n.getEvictionConfig()); gen.close(); } }
@SuppressWarnings("deprecation") private static void mapNearCacheConfigXmlGenerator(XmlGenerator gen, NearCacheConfig n) { if (n != null) { if (n.getName() != null) { gen.open("near-cache", "name", n.getName()); } else { gen.open("near-cache"); } gen.node("in-memory-format", n.getInMemoryFormat()) .node("invalidate-on-change", n.isInvalidateOnChange()) .node("time-to-live-seconds", n.getTimeToLiveSeconds()) .node("max-idle-seconds", n.getMaxIdleSeconds()) .node("serialize-keys", n.isSerializeKeys()) .node("cache-local-entries", n.isCacheLocalEntries()) .node("max-size", n.getMaxSize()) .node("eviction-policy", n.getEvictionPolicy()); evictionConfigXmlGenerator(gen, n.getEvictionConfig()); gen.close(); } }
private static void nearCache(XmlGenerator gen, String name, NearCacheConfig nearCache) { EvictionConfig eviction = nearCache.getEvictionConfig(); NearCachePreloaderConfig preloader = nearCache.getPreloaderConfig(); gen.open("near-cache", "name", name) .node("in-memory-format", nearCache.getInMemoryFormat()) .node("serialize-keys", nearCache.isSerializeKeys()) .node("invalidate-on-change", nearCache.isInvalidateOnChange()) .node("cache-local-entries", nearCache.isCacheLocalEntries()) .node("time-to-live-seconds", nearCache.getTimeToLiveSeconds()) .node("max-idle-seconds", nearCache.getMaxIdleSeconds()) .node("local-update-policy", nearCache.getLocalUpdatePolicy()) .node("eviction", null, "size", eviction.getSize(), "max-size-policy", eviction.getMaximumSizePolicy(), "eviction-policy", eviction.getEvictionPolicy()) .node("preloader", null, "enabled", preloader.isEnabled(), "directory", preloader.getDirectory(), "store-initial-delay-seconds", preloader.getStoreInitialDelaySeconds(), "store-interval-seconds", preloader.getStoreIntervalSeconds()); //close near-cache gen.close(); }
private static void nearCache(XmlGenerator gen, String name, NearCacheConfig nearCache) { EvictionConfig eviction = nearCache.getEvictionConfig(); NearCachePreloaderConfig preloader = nearCache.getPreloaderConfig(); gen.open("near-cache", "name", name) .node("in-memory-format", nearCache.getInMemoryFormat()) .node("serialize-keys", nearCache.isSerializeKeys()) .node("invalidate-on-change", nearCache.isInvalidateOnChange()) .node("cache-local-entries", nearCache.isCacheLocalEntries()) .node("time-to-live-seconds", nearCache.getTimeToLiveSeconds()) .node("max-idle-seconds", nearCache.getMaxIdleSeconds()) .node("local-update-policy", nearCache.getLocalUpdatePolicy()) .node("eviction", null, "size", eviction.getSize(), "max-size-policy", eviction.getMaximumSizePolicy(), "eviction-policy", eviction.getEvictionPolicy()) .node("preloader", null, "enabled", preloader.isEnabled(), "directory", preloader.getDirectory(), "store-initial-delay-seconds", preloader.getStoreInitialDelaySeconds(), "store-interval-seconds", preloader.getStoreIntervalSeconds()); //close near-cache gen.close(); }