|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.servo.util.ExpiringCache<K,V>
K - The type of keys maintainedV - The type of values maintainedpublic class ExpiringCache<K,V>
A semi-persistent mapping from keys to values. Values are automatically loaded by the cache, and are stored in the cache until evicted.
| Constructor Summary | |
|---|---|
ExpiringCache(long expireAfterMs,
ConcurrentHashMapV8.Fun<K,V> getter)
Create a new ExpiringCache that will expire entries after a given number of milliseconds computing the values as needed using the given getter. |
|
ExpiringCache(long expireAfterMs,
ConcurrentHashMapV8.Fun<K,V> getter,
long expirationFreqMs)
For unit tests. |
|
| Method Summary | |
|---|---|
V |
get(K key)
Get the (possibly cached) value for a given key. |
int |
size()
Return the number of entries in the cache. |
java.lang.String |
toString()
|
java.util.List<V> |
values()
Get the list of all values that are members of this cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ExpiringCache(long expireAfterMs,
ConcurrentHashMapV8.Fun<K,V> getter)
expireAfterMs - Number of milliseconds after which entries will be evictedgetter - Function that will be used to compute the values
public ExpiringCache(long expireAfterMs,
ConcurrentHashMapV8.Fun<K,V> getter,
long expirationFreqMs)
expireAfterMs - Number of milliseconds after which entries will be evictedgetter - Function that will be used to compute the valuesexpirationFreqMs - Frequency at which to schedule the job that evicts entries from the cache.| Method Detail |
|---|
public V get(K key)
public java.util.List<V> values()
public int size()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||