public final class ExpiringConcurrentCache<K,V> extends ConcurrentCache<K,V>
Modifier and Type | Class and Description |
---|---|
static interface |
ExpiringConcurrentCache.ExpiryChecker<K,V>
Interface for checking whether a cached object expired
|
ConcurrentCache.Factory<K,V>
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ConcurrentMap<K,java.util.concurrent.Future<V>> |
_cache |
private ExpiringConcurrentCache.ExpiryChecker<K,V> |
_checker |
private static java.util.logging.Logger |
_LOGGER |
Constructor and Description |
---|
ExpiringConcurrentCache(ConcurrentCache.Factory<K,V> f,
ExpiringConcurrentCache.ExpiryChecker<K,V> checker)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
private ExpiringConcurrentCache.ExpiryChecker<K,V> |
_getExpiryChecker() |
boolean |
containsKey(K key)
Tests whether the cache contains a value for the specified key
|
V |
get(K key)
Retrieves a value for the specified key.
|
getFactory
private final ExpiringConcurrentCache.ExpiryChecker<K,V> _checker
private static final java.util.logging.Logger _LOGGER
public ExpiringConcurrentCache(ConcurrentCache.Factory<K,V> f, ExpiringConcurrentCache.ExpiryChecker<K,V> checker)
f
- used to create new instances of objects that are not already availablechecker
- used to check whether an object in the cache has expiredpublic V get(K key) throws java.util.concurrent.ExecutionException
ConcurrentCache
Factory
interfaceget
in class ConcurrentCache<K,V>
key
- the key the value is associated withjava.util.concurrent.ExecutionException
public boolean containsKey(K key)
ConcurrentCache
containsKey
in class ConcurrentCache<K,V>
key
- key to testprivate ExpiringConcurrentCache.ExpiryChecker<K,V> _getExpiryChecker()
Copyright © 2002-2013 Oracle America, Inc. All Rights Reserved.