Commit 2b9775d5 authored by izeye's avatar izeye Committed by Stephane Nicoll

Fix EhCache hit/miss ratio

The hitRatio is the ratio of two windowed rates that are calculated
independently. They are not updated or read transactionally, hence the
ratio of the two can drift slightly from what might be expected.

We now make sure that the hit or miss ratio can't be higher than 1

Closes gh-3235
parent bbb27cf2
......@@ -37,8 +37,8 @@ public class EhCacheStatisticsProvider implements CacheStatisticsProvider<EhCach
statistics.setSize(ehCacheStatistics.getSize());
Double hitRatio = ehCacheStatistics.cacheHitRatio();
if (!hitRatio.isNaN()) {
statistics.setHitRatio(hitRatio);
statistics.setMissRatio(1 - hitRatio);
statistics.setHitRatio(hitRatio > 1 ? 1 : hitRatio);
statistics.setMissRatio(hitRatio > 1 ? 0 : 1 - hitRatio);
}
return statistics;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment