java.lang.Object
com.sun.faces.util.ConcurrentCache<K,V>
- Direct Known Subclasses:
ExpiringConcurrentCache
Defines a concurrent cache with a factory for creating new object instances.
This (combined with ExpiringConcurrentCache) offers functionality similar to com.sun.faces.util.Cache. Two
differences:
1. Cache is concrete/assumes a particular implementation. ConcurrentCache is abstract/allows subclasses to provide
the implementation. This facilitates alternative implementations, such as DefaultFaceletCache's NoCache. 2.
ConcurrentCache does not provide remove() as part of its contract, since remove behavior may be subclass-specific.
For example, ExpiringConcurentCache automatically removes items by checking for expiration rather than requiring
manual removes.
We should consider consolidating Cache and ConcurrentCache + ExpiringConcurrentCache into a single class hierarchy so
that we do not need to duplicate the JCIP scalable result cache code.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Factory interface for creating various cacheable objects. -
Constructor Summary
ConstructorDescriptionConstructs this cache using the specifiedFactory
. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
containsKey
(K key) Tests whether the cache contains a value for the specified keyabstract V
Retrieves a value for the specified key.protected final ConcurrentCache.Factory
<K, V> Retrieves aFactory
instance aasociated with this cache
-
Constructor Details
-
ConcurrentCache
Constructs this cache using the specifiedFactory
.- Parameters:
f
-
-
-
Method Details
-
get
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- Parameters:
key
- the key the value is associated with- Returns:
- the value for the specified key
- Throws:
ExecutionException
-
containsKey
Tests whether the cache contains a value for the specified key- Parameters:
key
- key to test- Returns:
- true if the value for the specified key is already cached, false otherwise
-
getFactory
Retrieves aFactory
instance aasociated with this cache- Returns:
Factory
instance
-