@SuppressWarnings("deprecation") static boolean isCacheOnUpdate(NearCacheConfig nearCacheConfig, String cacheName, ILogger logger) { NearCacheConfig.LocalUpdatePolicy localUpdatePolicy = nearCacheConfig.getLocalUpdatePolicy(); if (localUpdatePolicy == CACHE) { logger.warning(format("Deprecated local update policy is found for cache `%s`." + " The policy `%s` is subject to remove in further releases. Instead you can use `%s`", cacheName, CACHE, CACHE_ON_UPDATE)); return true; } return localUpdatePolicy == CACHE_ON_UPDATE; }
@SuppressWarnings("deprecation") static boolean isCacheOnUpdate(NearCacheConfig nearCacheConfig, String cacheName, ILogger logger) { NearCacheConfig.LocalUpdatePolicy localUpdatePolicy = nearCacheConfig.getLocalUpdatePolicy(); if (localUpdatePolicy == CACHE) { logger.warning(format("Deprecated local update policy is found for cache `%s`." + " The policy `%s` is subject to remove in further releases. Instead you can use `%s`", cacheName, CACHE, CACHE_ON_UPDATE)); return true; } return localUpdatePolicy == CACHE_ON_UPDATE; }
/** * Checks preconditions to create a map proxy with Near Cache. * * @param mapName name of the map that Near Cache will be created for * @param nearCacheConfig the {@link NearCacheConfig} to be checked * @param nativeMemoryConfig the {@link NativeMemoryConfig} of the Hazelcast instance * @param isClient {@code true} if the config is for a Hazelcast client, {@code false} otherwise */ public static void checkNearCacheConfig(String mapName, NearCacheConfig nearCacheConfig, NativeMemoryConfig nativeMemoryConfig, boolean isClient) { checkNotNativeWhenOpenSource(nearCacheConfig.getInMemoryFormat()); checkLocalUpdatePolicy(mapName, nearCacheConfig.getLocalUpdatePolicy()); checkEvictionConfig(nearCacheConfig.getEvictionConfig(), true); checkOnHeapNearCacheMaxSizePolicy(nearCacheConfig); checkNearCacheNativeMemoryConfig(nearCacheConfig.getInMemoryFormat(), nativeMemoryConfig, getBuildInfo().isEnterprise()); if (isClient && nearCacheConfig.isCacheLocalEntries()) { throw new IllegalArgumentException("The Near Cache option `cache-local-entries` is not supported in " + "client configurations."); } checkPreloaderConfig(nearCacheConfig, isClient); }
/** * Checks preconditions to create a map proxy with Near Cache. * * @param mapName name of the map that Near Cache will be created for * @param nearCacheConfig the {@link NearCacheConfig} to be checked * @param nativeMemoryConfig the {@link NativeMemoryConfig} of the Hazelcast instance * @param isClient {@code true} if the config is for a Hazelcast client, {@code false} otherwise */ public static void checkNearCacheConfig(String mapName, NearCacheConfig nearCacheConfig, NativeMemoryConfig nativeMemoryConfig, boolean isClient) { checkNotNativeWhenOpenSource(nearCacheConfig.getInMemoryFormat()); checkLocalUpdatePolicy(mapName, nearCacheConfig.getLocalUpdatePolicy()); checkEvictionConfig(nearCacheConfig.getEvictionConfig(), true); checkOnHeapNearCacheMaxSizePolicy(nearCacheConfig); checkNearCacheNativeMemoryConfig(nearCacheConfig.getInMemoryFormat(), nativeMemoryConfig, getBuildInfo().isEnterprise()); if (isClient && nearCacheConfig.isCacheLocalEntries()) { throw new IllegalArgumentException("The Near Cache option `cache-local-entries` is not supported in " + "client configurations."); } checkPreloaderConfig(nearCacheConfig, isClient); }
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()); } }
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(); }