diff --git a/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java b/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java index d36941d9fee..8e2f603bf03 100644 --- a/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java +++ b/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java @@ -147,8 +147,7 @@ public Optional getCache(T key, boolean refreshCache) { } if (cacheTime[0] + cacheTime[1] < System.currentTimeMillis()) { log.warn("[connection common cache] is timeout, remove it, key {}.", key); - timeoutMap.remove(key); - cacheMap.remove(key); + removeCache(key); return Optional.empty(); } C value = cacheMap.compute(key, (k, v) -> {