com.ctc.wstx.util
Class SimpleCache

java.lang.Object
  extended by com.ctc.wstx.util.SimpleCache

public final class SimpleCache
extends Object

Simple Map implementation usable for caches where contents do not expire, but where size needs to remain bounded.

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.


Field Summary
protected  com.ctc.wstx.util.SimpleCache.LimitMap mItems
           
protected  int mMaxSize
           
 
Constructor Summary
SimpleCache(int maxSize)
           
 
Method Summary
 void add(Object key, Object value)
           
 Object find(Object key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mItems

protected final com.ctc.wstx.util.SimpleCache.LimitMap mItems

mMaxSize

protected final int mMaxSize
Constructor Detail

SimpleCache

public SimpleCache(int maxSize)
Method Detail

find

public Object find(Object key)

add

public void add(Object key,
                Object value)