mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-09 09:24:03 +08:00
优化,使用SoftReference作为value,在内存不够的时候,自动释放缓存
This commit is contained in:
@@ -59,8 +59,9 @@ public class SimpleMonitorCache extends ConcurrentMapCache implements MonitorCac
|
||||
Object value = super.lookup(key);
|
||||
if (value != null && value instanceof Reference) {
|
||||
Reference reference = (Reference) value;
|
||||
if (reference != null) return reference.get();
|
||||
evict(key);
|
||||
value = reference.get();
|
||||
if (value == null)
|
||||
evict(key);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user