|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javaWebGen.util.CacheManager
public class CacheManager
Experimental and not well tested. Be very careful if you turn on
cluster mode!
Class provides a Simple Object cache. For keeping objects for reuse in memory
instead of always creating a new object. Each object type is kept in their own
repository generally by class name. EXAMPLE.
CacheManager cache = CacheManager.getInstance().add("1", Integer.class, New Integer(1) );
the object will be stored in the reposition for object of class Integer with
1 as it's key
| Field Summary | |
|---|---|
static long |
DEFAULT_EXPIRE_TIME
default time that an object will live in the cache * |
static char |
DELIM
used to build UDP DataPackets * |
| Method Summary | |
|---|---|
void |
add(java.lang.Object key,
java.lang.Class ctype,
java.lang.Object o)
Add an Object to the cache. |
void |
change(java.lang.Object key,
java.lang.Class type,
java.lang.Object o)
return an object from the pool |
protected void |
cleanUp()
check to see if any objects need to be removed |
void |
clear()
removes all object from the cache |
void |
delete(java.lang.Object key,
java.lang.Class type)
removes an object from cache |
protected void |
finalize()
this method simply notifies the background thread to stop running |
java.lang.Object |
get(java.lang.Object key,
java.lang.Class type)
get an object from the cache returns null if empty |
static CacheManager |
getCacheManager()
|
static CacheManager |
getCacheManager(int time)
returns a new CacheMananager |
static CacheManager |
getInstance()
Get a configured CacheManager instance configured with a properties file |
int |
getSize()
The number of total Object(s) in Cache |
boolean |
isCached(java.lang.Object key,
java.lang.Class type)
is this object cached? |
protected void |
remove(java.lang.Object key,
java.lang.Class type)
remove a Object from the cache |
protected void |
remove(java.lang.Object key,
java.lang.String type)
removes an Object from the cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long DEFAULT_EXPIRE_TIME
public static final char DELIM
| Method Detail |
|---|
public static CacheManager getInstance()
public static CacheManager getCacheManager()
public static CacheManager getCacheManager(int time)
time - expire time
protected void remove(java.lang.Object key,
java.lang.Class type)
key - type - class being removed from the cache
protected void remove(java.lang.Object key,
java.lang.String type)
key - name of the class type being removed from thetype - name of the class type being removed from the
cache(IE result of Class.getName() )CacheListenerpublic int getSize()
public void add(java.lang.Object key,
java.lang.Class ctype,
java.lang.Object o)
key - namectype - object type(class) being addedo - object being added
public java.lang.Object get(java.lang.Object key,
java.lang.Class type)
key - nametype - class type
public boolean isCached(java.lang.Object key,
java.lang.Class type)
key - type - class of object
public void change(java.lang.Object key,
java.lang.Class type,
java.lang.Object o)
key - to store object undertype - class of object being storedo - object from pool
public void delete(java.lang.Object key,
java.lang.Class type)
key - of objecttype - of objectpublic void clear()
protected void cleanUp()
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||