public class ResourceLimitedMap<Key,Value>
extends java.lang.Object
| Constructor and Description |
|---|
ResourceLimitedMap(int cacheSize,
ResourceLimitedMapFunctor<Key,Value> functor)
Create LRU cache
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(Key key)
Determine if the map contains the given key.
|
void |
finalizeAll()
Remove all the values from the map, and call functory.finalizeValue() on each of them.
|
Value |
get(Key key)
Return an existing value, or create a new one if necessary.
|
Value |
remove(Key key) |
public ResourceLimitedMap(int cacheSize,
ResourceLimitedMapFunctor<Key,Value> functor)
cacheSize - Max number of objects to be stored in the cache.functor - Encapsulates methods for creating a new object if it isn't in the cache, and
for finalizing an object that is getting LRU'ed out of the cache.public Value get(Key key)
key - Key of desired value.public boolean containsKey(Key key)
key - public void finalizeAll()