|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
com.compoundtheory.objectcache.ObjectCache
public class ObjectCache
Object for persisting ColdFusion CFCs
| Field Summary | |
|---|---|
static java.lang.String |
CLEAR_CFC_KEY
|
static java.lang.String |
CLEAR_SOFTREF_KEY
|
| Constructor Summary | |
|---|---|
ObjectCache(java.lang.String className,
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor threadPool)
Default constructor of unlimited objects, and always persisted |
|
ObjectCache(java.lang.String className,
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor threadPool,
Config config)
Constructor for a new Object Cache |
|
| Method Summary | |
|---|---|
void |
add(java.lang.ref.SoftReference softRef,
java.lang.String key)
Adds an object to the cache |
void |
discard(java.lang.String key)
discard a key from the cache |
java.lang.Object |
get(java.lang.String key)
Retrieve an object from the cache |
int |
getCalculatedSize()
Returns the calculated size (slow), by looping through a copy of the collection and checking if the soft references are cleared or not |
int |
getEstimatedSize()
Returns the estimate size of the cache (fast), does not scan the cache for empty soft references |
boolean |
has(java.lang.String key)
If the cache has the object, and it hasn't expired |
void |
reap(java.lang.ref.SoftReference softRef)
Reaps out the soft ref required |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CLEAR_CFC_KEY
public static final java.lang.String CLEAR_SOFTREF_KEY
| Constructor Detail |
|---|
public ObjectCache(java.lang.String className,
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor threadPool)
throws InvalidScopeException
InvalidScopeException
public ObjectCache(java.lang.String className,
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor threadPool,
Config config)
className - the name of the class that this cache representsthreadPool - the thread poolconfig - the configuration for this cache.| Method Detail |
|---|
public boolean has(java.lang.String key)
key - The key to look for the object is stored under
public java.lang.Object get(java.lang.String key)
throws ObjectNotFoundException
key - The key to look for
ObjectNotFoundException - If the object doesn't exist in the cache, this is thrown
public void add(java.lang.ref.SoftReference softRef,
java.lang.String key)
softRef - the soft reference that contains the objectkey - The key to store it under. This should be uniquepublic void discard(java.lang.String key)
key - the key to discardpublic void reap(java.lang.ref.SoftReference softRef)
softRef - the soft ref that has been clearedpublic int getEstimatedSize()
public int getCalculatedSize()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||