/** * @deprecated since 3.8, please use * {@link NearCacheConfig#NearCacheConfig(int, int, boolean, InMemoryFormat, EvictionConfig)} */ @Deprecated public NearCacheConfig(int timeToLiveSeconds, int maxSize, String evictionPolicy, int maxIdleSeconds, boolean invalidateOnChange, InMemoryFormat inMemoryFormat, EvictionConfig evictionConfig) { this.inMemoryFormat = inMemoryFormat; this.invalidateOnChange = invalidateOnChange; this.timeToLiveSeconds = timeToLiveSeconds; this.maxIdleSeconds = maxIdleSeconds; this.maxSize = calculateMaxSize(maxSize); this.evictionPolicy = evictionPolicy; // EvictionConfig is not allowed to be null if (evictionConfig != null) { this.evictionConfig = evictionConfig; } else { this.evictionConfig.setSize(calculateMaxSize(maxSize)); this.evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(evictionPolicy)); this.evictionConfig.setMaximumSizePolicy(ENTRY_COUNT); } }
/** * @deprecated since 3.8, please use * {@link NearCacheConfig#NearCacheConfig(int, int, boolean, InMemoryFormat, EvictionConfig)} */ @Deprecated public NearCacheConfig(int timeToLiveSeconds, int maxSize, String evictionPolicy, int maxIdleSeconds, boolean invalidateOnChange, InMemoryFormat inMemoryFormat, EvictionConfig evictionConfig) { this.inMemoryFormat = inMemoryFormat; this.invalidateOnChange = invalidateOnChange; this.timeToLiveSeconds = timeToLiveSeconds; this.maxIdleSeconds = maxIdleSeconds; this.maxSize = calculateMaxSize(maxSize); this.evictionPolicy = evictionPolicy; // EvictionConfig is not allowed to be null if (evictionConfig != null) { this.evictionConfig = evictionConfig; } else { this.evictionConfig.setSize(calculateMaxSize(maxSize)); this.evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(evictionPolicy)); this.evictionConfig.setMaximumSizePolicy(ENTRY_COUNT); } }
/** * Sets the maximum size of the Near Cache. * <p> * When the maxSize is reached, the Near Cache is evicted based on the policy defined. * <p> * Accepts any integer between {@code 0} and {@link Integer#MAX_VALUE}. * The value {@code 0} means {@link Integer#MAX_VALUE}. * The default is {@code 0}. * * @param maxSize the maximum size of the Near Cache * @return this Near Cache config instance * @deprecated since 3.8, please use {@link #setEvictionConfig(EvictionConfig)} and {@link EvictionConfig#setSize(int)} */ @Deprecated public NearCacheConfig setMaxSize(int maxSize) { checkNotNegative(maxSize, "maxSize cannot be a negative number!"); this.maxSize = calculateMaxSize(maxSize); this.evictionConfig.setSize(this.maxSize); this.evictionConfig.setMaximumSizePolicy(ENTRY_COUNT); return this; }
/** * Sets the maximum size of the Near Cache. * <p> * When the maxSize is reached, the Near Cache is evicted based on the policy defined. * <p> * Accepts any integer between {@code 0} and {@link Integer#MAX_VALUE}. * The value {@code 0} means {@link Integer#MAX_VALUE}. * The default is {@code 0}. * * @param maxSize the maximum size of the Near Cache * @return this Near Cache config instance * @deprecated since 3.8, please use {@link #setEvictionConfig(EvictionConfig)} and {@link EvictionConfig#setSize(int)} */ @Deprecated public NearCacheConfig setMaxSize(int maxSize) { checkNotNegative(maxSize, "maxSize cannot be a negative number!"); this.maxSize = calculateMaxSize(maxSize); this.evictionConfig.setSize(this.maxSize); this.evictionConfig.setMaximumSizePolicy(ENTRY_COUNT); return this; }
public NearCacheConfig(int timeToLiveSeconds, int maxIdleSeconds, boolean invalidateOnChange, InMemoryFormat inMemoryFormat, EvictionConfig evictionConfig) { this.inMemoryFormat = inMemoryFormat; this.invalidateOnChange = invalidateOnChange; this.timeToLiveSeconds = timeToLiveSeconds; this.maxIdleSeconds = maxIdleSeconds; this.maxSize = calculateMaxSize(maxSize); // EvictionConfig is not allowed to be null if (evictionConfig != null) { this.maxSize = evictionConfig.getSize(); this.evictionPolicy = evictionConfig.getEvictionPolicy().toString(); this.evictionConfig = evictionConfig; } }
public NearCacheConfig(int timeToLiveSeconds, int maxIdleSeconds, boolean invalidateOnChange, InMemoryFormat inMemoryFormat, EvictionConfig evictionConfig) { this.inMemoryFormat = inMemoryFormat; this.invalidateOnChange = invalidateOnChange; this.timeToLiveSeconds = timeToLiveSeconds; this.maxIdleSeconds = maxIdleSeconds; this.maxSize = calculateMaxSize(maxSize); // EvictionConfig is not allowed to be null if (evictionConfig != null) { this.maxSize = evictionConfig.getSize(); this.evictionPolicy = evictionConfig.getEvictionPolicy().toString(); this.evictionConfig = evictionConfig; } }