What is the difference between "cache misses" and "cache misses" in Ehcache?

I look at the EhCache statistics, I see these numbers:

CacheMisses: 75977
CacheHits: 38151

InMemoryCacheMisses: 4843
InMemoryCacheHits: 38151

"memory" is the only store - without heap and without disk storage ( overflowToDisk="false", diskPersistent="false" ). So what do these two mean? I would expect them to be the same (hits are the same), but misses vary a lot.

+7
source share
2 answers

Do you have a null price Element in your cache? (Ehcache allows you to store an Element with null values, but I'm not sure if there are any restrictions there).

Looking at the Cache.searchInStoreWithStats code (object key) in version 2.5.3, it seems that there is an error:

  • A test that determines whether to increase inMemoryMisses , use the containsKey() derivative,
  • whereas the test for incrementing cacheMisses null checks the result of the get() derivative.

So, every time you look for a key that exists in InMemoryStore but is null , it will increment cacheMisses , but not inMemoryMisses .

So, I could be completely off, but it smells to me. What do you think?

Edit: I realized that my interpretation was wrong - the element cannot be null (but its "value" can be null). I will leave this answer here, one way or another, if it raises any other ideas.

+1
source

I believe that you are using ehcache 2.5+. If you have a cache configuration with true disk support (although overflowtodisk is false), it writes to disk. So can there be mischief? You can view them in statistics. Do you have discursiveness as true? Submit cache configuration

0
source

All Articles