修复putWithoutLock存在的外部资源泄露问题

This commit is contained in:
yanzhongxin 2025-06-04 15:03:11 +08:00
parent 420e54a37d
commit 7739f8b015

View File

@ -89,7 +89,11 @@ public abstract class AbstractCache<K, V> implements Cache<K, V> {
// issue#3618 对于替换的键值对不做满队列检查和清除
if (cacheMap.containsKey(mKey)) {
// 存在相同key覆盖之
CacheObj<K, V> oldObj = cacheMap.get(mKey);
if (oldObj != null) {
onRemove(oldObj.key, oldObj.obj);
cacheMap.remove(mKey);
}
cacheMap.put(mKey, co);
} else {
if (isFull()) {