
com.librato.metrics.reporter.LRU Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metrics-librato Show documentation
Show all versions of metrics-librato Show documentation
The LibratoReporter class runs in the background, publishing
metrics to the Librato Metrics API at the
specified interval.
The newest version!
package com.librato.metrics.reporter;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
public class LRU {
private final Map cache;
public LRU(final int maxSize) {
this.cache = Collections.synchronizedMap(new LinkedHashMap() {
@Override
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > maxSize;
}
});
}
public V get(K key) {
return cache.get(key);
}
public void set(K key, V result) {
cache.put(key, result);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy