com.ctc.wstx.util
Class SimpleCache
java.lang.Object
com.ctc.wstx.util.SimpleCache
public final class SimpleCache
- extends java.lang.Object
Simple Map implementation usable for caches where contents do not
expire.
For JDK 1.4 and up, will use LinkedHashMap
in LRU mode,
so expiration does happen using typical LRU algorithm. For 1.3 and
below will just discard an entry in random.
Note: we probably should use weak references, or something similar
to limit maximum memory usage. This could be implemented in many
ways, perhaps by using two areas: first, smaller one, with strong
refs, and secondary bigger one that uses soft references.
Method Summary |
void |
add(java.lang.Object key,
java.lang.Object value)
|
java.lang.Object |
find(java.lang.Object key)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleCache
public SimpleCache(int maxSize)
find
public java.lang.Object find(java.lang.Object key)
add
public void add(java.lang.Object key,
java.lang.Object value)