IDEMPIERE-4405 Add basic cache statistics (#211)

fix wrong hit/miss count when cached value is null
This commit is contained in:
hengsin 2020-08-07 23:07:39 +08:00 committed by GitHub
parent 147eebb01b
commit 0ad8737829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -303,7 +303,10 @@ public class CCache<K,V> implements CacheInterface, Map<K, V>, 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;