Package com.sun.faces.util
Class Cache<K,V>
- java.lang.Object
-
- com.sun.faces.util.Cache<K,V>
-
public class Cache<K,V> extends Object
A concurrent caching mechanism.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCache.Factory<K,V>Factory interface for creating various cacheable objects.
-
Constructor Summary
Constructors Constructor Description Cache(Cache.Factory<K,V> factory)Constructs this cache using the specifiedFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vget(K key)If a value isn't associated with the specified key, a newCallablewill be created wrapping theFactoryspecified via the constructor and passed to aFutureTask.Vremove(K key)
-
-
-
Constructor Detail
-
Cache
public Cache(Cache.Factory<K,V> factory)
Constructs this cache using the specifiedFactory.- Parameters:
factory-
-
-
Method Detail
-
get
public V get(K key)
If a value isn't associated with the specified key, a newCallablewill be created wrapping theFactoryspecified via the constructor and passed to aFutureTask. This task will be passed to the backing ConcurrentMap. WhenFutureTask.get()is invoked, the Factory will return the new Value which will be cached by theFutureTask.- Parameters:
key- the key the value is associated with- Returns:
- the value for the specified key, if any
-
-