public class SoftExpiringCache<K,V> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SoftExpiringCache.CachedObject<V> |
| Constructor and Description |
|---|
SoftExpiringCache(Cache<K,V> cache)
Create a new TtlCache with the given capacity and TTL values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(K key,
V value,
long maxAge)
Add an element to the cache, with the intended max age for its cache entry provided in
milliseconds.
|
SoftExpiringCache.CachedObject<V> |
getElement(K key)
Retrieve an element from the cache by key.
|
void |
setTimeSource(TimeSource timeSource)
Set a new time source.
|
public SoftExpiringCache.CachedObject<V> getElement(K key)
key - Key whose element to look up.public void addElement(K key, V value, long maxAge)
key - The key to store the entry for.value - The value to store.maxAge - The maximum age for this entry before it is deemed expired.public void setTimeSource(TimeSource timeSource)
timeSource - New time source to use.Copyright © 2007-2012. All Rights Reserved.