Skip to content

Commit

Permalink
Support AsyncCache in CaffeineCacheMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye committed Mar 2, 2019
1 parent 6f6a6de commit b343b57
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -99,7 +96,7 @@ public CaffeineCacheMetrics(Cache<?, ?> cache, String cacheName, Iterable<Tag> t
* @param <C> The cache type.
* @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
*/
public static <C extends AsyncLoadingCache<?, ?>> C monitor(MeterRegistry registry, C cache, String cacheName, String... tags) {
public static <C extends AsyncCache<?, ?>> C monitor(MeterRegistry registry, C cache, String cacheName, String... tags) {
return monitor(registry, cache, cacheName, Tags.of(tags));
}

Expand All @@ -115,7 +112,7 @@ public CaffeineCacheMetrics(Cache<?, ?> cache, String cacheName, Iterable<Tag> t
* @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
* @see CacheStats
*/
public static <C extends AsyncLoadingCache<?, ?>> C monitor(MeterRegistry registry, C cache, String cacheName, Iterable<Tag> tags) {
public static <C extends AsyncCache<?, ?>> C monitor(MeterRegistry registry, C cache, String cacheName, Iterable<Tag> tags) {
monitor(registry, cache.synchronous(), cacheName, tags);
return cache;
}
Expand Down

0 comments on commit b343b57

Please sign in to comment.