开启allowNullValues

This commit is contained in:
zhouhao
2016-10-26 17:29:40 +08:00
parent af76d0c1e2
commit edff00b715

View File

@@ -27,11 +27,11 @@ import java.util.concurrent.atomic.AtomicInteger;
public class SimpleMonitorCache extends ConcurrentMapCache implements MonitorCache {
private final AtomicInteger totalTimes = new AtomicInteger(0);
private final AtomicInteger hitTimes = new AtomicInteger(0);
private final AtomicInteger putTimes = new AtomicInteger(0);
private final AtomicInteger hitTimes = new AtomicInteger(0);
private final AtomicInteger putTimes = new AtomicInteger(0);
public SimpleMonitorCache(String name) {
super(name, false);
super(name, true);
}
@Override
@@ -87,19 +87,20 @@ public class SimpleMonitorCache extends ConcurrentMapCache implements MonitorCac
}
protected Object buildValue(Object value) {
if (null == value) return null;
return new SoftReference(value);
}
@Override
public void put(Object key, Object value) {
if (key == null || value == null) return;
if (key == null) return;
putTimes.addAndGet(1);
super.put(key, buildValue(value));
}
@Override
public ValueWrapper putIfAbsent(Object key, Object value) {
if (key == null || value == null) return null;
if (key == null) return null;
putTimes.addAndGet(1);
return super.putIfAbsent(key, buildValue(value));
}