Package com.sun.faces.util
Class ExpiringConcurrentCache<K,V>
- java.lang.Object
-
- com.sun.faces.util.ConcurrentCache<K,V>
-
- com.sun.faces.util.ExpiringConcurrentCache<K,V>
-
public final class ExpiringConcurrentCache<K,V> extends ConcurrentCache<K,V>
This class implements an abstract ConcurrentCache with objects in the cache potentially expiring. Only non-expired objects will be returned from the cache or considered to be contained in the cache The cache is self-managing, so no remove() method is defined
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ExpiringConcurrentCache.ExpiryChecker<K,V>
Interface for checking whether a cached object expired-
Nested classes/interfaces inherited from class com.sun.faces.util.ConcurrentCache
ConcurrentCache.Factory<K,V>
-
-
Constructor Summary
Constructors Constructor Description ExpiringConcurrentCache(ConcurrentCache.Factory<K,V> f, ExpiringConcurrentCache.ExpiryChecker<K,V> checker)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(K key)
Tests whether the cache contains a value for the specified keyV
get(K key)
Retrieves a value for the specified key.-
Methods inherited from class com.sun.faces.util.ConcurrentCache
getFactory
-
-
-
-
Constructor Detail
-
ExpiringConcurrentCache
public ExpiringConcurrentCache(ConcurrentCache.Factory<K,V> f, ExpiringConcurrentCache.ExpiryChecker<K,V> checker)
Public constructor.- Parameters:
f
- used to create new instances of objects that are not already availablechecker
- used to check whether an object in the cache has expired
-
-
Method Detail
-
get
public V get(K key) throws ExecutionException
Description copied from class:ConcurrentCache
Retrieves a value for the specified key. If the value is not already present in the cache, a new instance will be allocated using theFactory
interface- Specified by:
get
in classConcurrentCache<K,V>
- Parameters:
key
- the key the value is associated with- Returns:
- the value for the specified key
- Throws:
ExecutionException
-
containsKey
public boolean containsKey(K key)
Description copied from class:ConcurrentCache
Tests whether the cache contains a value for the specified key- Specified by:
containsKey
in classConcurrentCache<K,V>
- Parameters:
key
- key to test- Returns:
- true if the value for the specified key is already cached, false otherwise
-
-