From 2b9775d5933feb95b539d32611fca94fe4b62c6e Mon Sep 17 00:00:00 2001 From: izeye Date: Mon, 15 Jun 2015 21:27:32 +0900 Subject: [PATCH] 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 --- .../boot/actuate/cache/EhCacheStatisticsProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/EhCacheStatisticsProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/EhCacheStatisticsProvider.java index 6bfd671c66..98301e3629 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/EhCacheStatisticsProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/EhCacheStatisticsProvider.java @@ -37,8 +37,8 @@ public class EhCacheStatisticsProvider implements CacheStatisticsProvider 1 ? 1 : hitRatio); + statistics.setMissRatio(hitRatio > 1 ? 0 : 1 - hitRatio); } return statistics; }