I'm looking in the EhCache statistics, I see these figures:
CacheMisses: 75977
CacheHits: 38151InMemoryCacheMisses: 4843
InMemoryCacheHits: 38151
"memory" is the only store - no off-heap and no disk storage (overflowToDisk="false", diskPersistent="false"
). So what does these two mean? I would expect them to be the same (the hits are the same), but the misses differ greatly.
Do you have some null
-valued Element
s in your cache? (Ehcache allows you to store Element
s with null
values, but I'm not sure if there's any constraints surrounding that).
Looking at the code for Cache.searchInStoreWithStats(Object key) in version 2.5.3, it seems that there is a bug there:
inMemoryMisses
uses a containsKey()
derivative, cacheMisses
null-checks against the result of a get()
derivative.So, each time you search for a key which exists in the InMemoryStore
but has a null
value, it will increment cacheMisses
but not inMemoryMisses
.
So, I might be completely off, but it smells right to me. What do you think?
Edit: I've realised my interpretation was wrong - the Element can't be null, (but its 'value' can be null). I'll leave this answer here anyway incase it triggers any other ideas
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With