|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.compoundtheory.objectcache.CacheManager
public class CacheManager
This is a cache manager for a set of classes
| Constructor Summary | |
|---|---|
CacheManager(CacheConfig config,
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor threadPool)
Constructor, requires the config object |
|
| Method Summary | |
|---|---|
void |
add(java.lang.String clazz,
java.lang.String key,
java.lang.ref.SoftReference softRef)
Adds an object to to the cache |
void |
discard(java.lang.String clazz,
java.lang.String key)
Discard the object from the cache |
java.lang.Object |
get(java.lang.String clazz,
java.lang.String key)
Retrieve a CFC from the cache |
java.util.Set |
getCachedClasses()
gets the set of classes that are stored in this cache |
int |
getCalculatedSize(java.lang.String clazz)
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(java.lang.String clazz)
Returns the estimate size of the cache (fast), does not scan the cache for empty soft references |
boolean |
has(java.lang.String clazz,
java.lang.String key)
Whether the CFC has been cached |
java.lang.Object |
popReapedCFC(java.lang.ref.SoftReference softRef)
remove a soft reference cleared object from the map so it can be fired for a discard queue |
void |
reap(java.lang.String clazz,
java.lang.ref.SoftReference softRef)
Reap off a cleared soft reference |
void |
update(java.util.Observable o,
java.lang.Object arg)
Push the cfc onto the reap map |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CacheManager(CacheConfig config,
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor threadPool)
config - The config object that defines the caching settings for each
class| Method Detail |
|---|
public boolean has(java.lang.String clazz,
java.lang.String key)
has in interface ICacheManagerclazz - The class of CFCkey - The key the CFC is stored under
public java.lang.Object get(java.lang.String clazz,
java.lang.String key)
throws ObjectNotFoundException
get in interface ICacheManagerclazz - The class of the CFCkey - The key it was stored under
ObjectNotFoundException - if the object doesn't exist in the cache
public void add(java.lang.String clazz,
java.lang.String key,
java.lang.ref.SoftReference softRef)
add in interface ICacheManagerclazz - The class of the objectkey - The key of the objectsoftRef - The soft reference containing the CFC
public void discard(java.lang.String clazz,
java.lang.String key)
discard in interface ICacheManagerclazz - the class of the objectkey - the key of the object to discard
public void reap(java.lang.String clazz,
java.lang.ref.SoftReference softRef)
reap in interface ICacheManagerclazz - the class to reap tosoftRef - the soft reference to reappublic java.util.Set getCachedClasses()
getCachedClasses in interface ICacheManagerpublic int getCalculatedSize(java.lang.String clazz)
clazz - the class to get the size for
public int getEstimatedSize(java.lang.String clazz)
clazz - the class to get the size for
public void update(java.util.Observable o,
java.lang.Object arg)
update in interface java.util.Observerpublic java.lang.Object popReapedCFC(java.lang.ref.SoftReference softRef)
popReapedCFC in interface ICacheManagersoftRef - the softreference to be cleared
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||