Class CacheBase<K,V,D>
java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.CacheBase<K,V,D>
- Type Parameters:
K- Cache lookup key typeV- Cache instance value typeD- Data type for creating a new instance value
- Direct Known Subclasses:
SoftCache
Base class for cache implementations.
To use, instantiate a subclass of a concrete implementation class, where the subclass
implements the createInstance() method, and call get() with the key and the data.
The get() call will use the data only if it needs to call createInstance(),
otherwise the data is ignored.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract VcreateInstance(K key, D data) Creates an instance for the key and data.abstract VgetInstance(K key, D data) Retrieves an instance from the cache.
-
Constructor Details
-
CacheBase
public CacheBase()
-
-
Method Details
-
getInstance
Retrieves an instance from the cache. Calls createInstance(key, data) if the cache does not already contain an instance with this key. Ignores data if the cache already contains an instance with this key.- Parameters:
key- Cache lookup key for the requested instancedata- Data for createInstance() if the instance is not already cached- Returns:
- The requested instance
-
createInstance
-