From 0ad87378298f115046658b14ffbe0d4d3e780653 Mon Sep 17 00:00:00 2001 From: hengsin Date: Fri, 7 Aug 2020 23:07:39 +0800 Subject: [PATCH] IDEMPIERE-4405 Add basic cache statistics (#211) fix wrong hit/miss count when cached value is null --- org.adempiere.base/src/org/compiere/util/CCache.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/util/CCache.java b/org.adempiere.base/src/org/compiere/util/CCache.java index f4bd8cfa2f..73bb480ee0 100644 --- a/org.adempiere.base/src/org/compiere/util/CCache.java +++ b/org.adempiere.base/src/org/compiere/util/CCache.java @@ -303,7 +303,10 @@ public class CCache implements CacheInterface, Map, Serializable expire(); V v = cache.get(key); if (v == null) - m_miss.getAndAdd(1); + if (nullList.contains(key)) + m_hit.getAndAdd(1); + else + m_miss.getAndAdd(1); else m_hit.getAndAdd(1); return v;