diff --git a/scheduler/src/main/java/com/zfoo/scheduler/util/LazyCache.java b/scheduler/src/main/java/com/zfoo/scheduler/util/LazyCache.java index b1b9a3d69..58a78d573 100644 --- a/scheduler/src/main/java/com/zfoo/scheduler/util/LazyCache.java +++ b/scheduler/src/main/java/com/zfoo/scheduler/util/LazyCache.java @@ -16,7 +16,7 @@ */ public class LazyCache { - private static final float DEFAULT_BACK_PRESSURE_FACTOR = 0.11f; + private static final float DEFAULT_BACK_PRESSURE_FACTOR = 0.13f; private static class CacheValue { public volatile V value; @@ -63,7 +63,7 @@ public static enum RemovalCause { public LazyCache(int maximumSize, long expireAfterAccessMillis, long expireCheckIntervalMillis, BiConsumer, RemovalCause> removeListener) { this.maximumSize = maximumSize; - this.backPressureSize = maximumSize + (int) (maximumSize * DEFAULT_BACK_PRESSURE_FACTOR); + this.backPressureSize = Math.max(maximumSize, maximumSize + (int) (maximumSize * DEFAULT_BACK_PRESSURE_FACTOR)); this.expireAfterAccessMillis = expireAfterAccessMillis; this.expireCheckIntervalMillis = expireCheckIntervalMillis; this.minExpireTime = TimeUtils.now();