public abstract class CacheHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_CACHE_SIZE |
static java.util.logging.Logger |
logger |
protected int |
logicalClock |
protected CacheObject[] |
objs |
Constructor and Description |
---|
CacheHandler()
Standard default constructor
|
CacheHandler(int max_size)
Constructor used when you know the limits
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected CacheObject[] objs
protected int logicalClock
public static java.util.logging.Logger logger
public static int DEFAULT_MAX_CACHE_SIZE
public CacheHandler()
public CacheHandler(int max_size)
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()
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details