|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.util.Cache
public class Cache
A simple cache structure that uses Reference objects to hold objects and a background thread to reap dead entries when they go away. Subclasses can define different cache miss behavior or the class can just be used directly as a simple weak-referenced cache (ie: if the object is GC'ed it will be removed from cache.)
Constructor Summary | |
---|---|
Cache()
|
Method Summary | |
---|---|
void |
cacheObject(java.lang.Object id,
java.lang.Object obj)
Caches the specified object associated with the specified key. |
java.lang.Object |
getCachedObject(java.lang.Object id)
Returns the cached object for the specified ID if it exists or null if it is not in the cache. |
boolean |
uncacheObject(java.lang.Object id)
Uncaches the object for the specified ID. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cache()
Method Detail |
---|
public java.lang.Object getCachedObject(java.lang.Object id)
public void cacheObject(java.lang.Object id, java.lang.Object obj)
public boolean uncacheObject(java.lang.Object id)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |