|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.util.cacheHandler.CacheHandler
public abstract class CacheHandler
A base cache support object. Based on the com.bbn.openmap.layer.util.cacheHandler package components, this CacheHandler uses Objects instead of Strings and will be replacing the earlier version.
Field Summary | |
---|---|
static int |
DEFAULT_MAX_CACHE_SIZE
|
static java.util.logging.Logger |
logger
|
protected int |
logicalClock
|
protected CacheObject[] |
objs
|
Constructor Summary | |
---|---|
CacheHandler()
Standard default constructor |
|
CacheHandler(int max_size)
Constructor used when you know the limits |
Method Summary | |
---|---|
void |
clear()
Remove all the objects from the cache. |
java.lang.Object |
get(java.lang.Object key)
The main call to retrieve something from the cache |
int |
getCacheSize()
Get the current size of the cache. |
java.util.ListIterator<CacheObject> |
listIterator()
Return a ListIterator of the cache objects. |
abstract CacheObject |
load(java.lang.Object key)
Called from get if the key doesn't exist, to "load" the new object into the cache before returning it. |
protected void |
replaceLeastUsed(CacheObject newObj)
If there is space in the cache, put the object in. |
void |
resetCache()
Need to clear memory, get gc moving, and ready for new objects |
void |
resetCache(int max_size)
Need to clear memory, get gc moving, and ready for new objects. |
CacheObject |
searchCache(java.lang.Object key)
Search the cache for a match -return null if not found. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected CacheObject[] objs
protected int logicalClock
public static java.util.logging.Logger logger
public static int DEFAULT_MAX_CACHE_SIZE
Constructor Detail |
---|
public CacheHandler()
public CacheHandler(int max_size)
Method Detail |
---|
public void clear()
public void resetCache()
public void resetCache(int max_size)
max_size
- the capacity of the Hashtable.public int getCacheSize()
public java.lang.Object get(java.lang.Object key)
public abstract CacheObject load(java.lang.Object key)
public CacheObject searchCache(java.lang.Object key)
protected void replaceLeastUsed(CacheObject newObj)
public java.util.ListIterator<CacheObject> listIterator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |