From c8b074cf4973bf77b7acd7d99297c65b2b70a66a Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Thu, 11 Apr 2019 00:33:30 +0900 Subject: [PATCH] Support AsyncCache in CaffeineCacheMetrics (#1255) Closes gh-1254 --- .../instrument/binder/cache/CaffeineCacheMetrics.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java index 6cdc5f9ed8..42193bd167 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java @@ -15,10 +15,7 @@ */ package io.micrometer.core.instrument.binder.cache; -import com.github.benmanes.caffeine.cache.AsyncLoadingCache; -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; +import com.github.benmanes.caffeine.cache.*; import com.github.benmanes.caffeine.cache.stats.CacheStats; import io.micrometer.core.instrument.*; import io.micrometer.core.lang.NonNullApi; @@ -99,7 +96,7 @@ public CaffeineCacheMetrics(Cache cache, String cacheName, Iterable t * @param The cache type. * @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way. */ - public static > C monitor(MeterRegistry registry, C cache, String cacheName, String... tags) { + public static > C monitor(MeterRegistry registry, C cache, String cacheName, String... tags) { return monitor(registry, cache, cacheName, Tags.of(tags)); } @@ -115,7 +112,7 @@ public CaffeineCacheMetrics(Cache cache, String cacheName, Iterable t * @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way. * @see CacheStats */ - public static > C monitor(MeterRegistry registry, C cache, String cacheName, Iterable tags) { + public static > C monitor(MeterRegistry registry, C cache, String cacheName, Iterable tags) { monitor(registry, cache.synchronous(), cacheName, tags); return cache; }