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 3973a09ba..3858ffdba 100644 --- a/scheduler/src/main/java/com/zfoo/scheduler/util/LazyCache.java +++ b/scheduler/src/main/java/com/zfoo/scheduler/util/LazyCache.java @@ -85,6 +85,9 @@ public void put(K key, V value) { var cacheValue = new CacheValue(); cacheValue.value = value; cacheValue.expireTime = TimeUtils.now() + expireAfterAccessMillis; + if (cacheValue.expireTime < this.minExpireTime) { + this.minExpireTime = cacheValue.expireTime; + } var oldCacheValue = cacheMap.put(key, cacheValue); if (oldCacheValue != null) { removeListener.accept(List.of(new Pair<>(key, oldCacheValue.value)), RemovalCause.REPLACED);