|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable
org.ceryle.util.Cache
public class Cache
Extends Hashtable as an Object cache.
| Field Summary | |
|---|---|
static int |
DEFAULT_SIZE
The value of the default cache size. |
static int |
hysteresis
The value of size-trimming hysteresis (the amount over the limit permitted prior to trimming, used to reduce the cost of trimming). |
| Constructor Summary | |
|---|---|
Cache()
Constructor for an Cache using the default cache size (of 50) and automatically checking the limit. |
|
Cache(int limit,
boolean autocheck)
Constructor for an Cache with a cache size limit and the boolean controlling whether the limit check is automatic or manual. |
|
| Method Summary | |
|---|---|
protected void |
addToCache(String key,
Object o)
Adds the Object o to the cache using the String key as the key. |
Object |
checkCacheFor(String key)
Checks the cache for an Object corresponding to key, returning null if it is not in the cache, or if caching is inactive. |
void |
checkLimit()
Checks the current cache size against the limit and removes objects as necessary to reach the limit. |
void |
clear()
Clears the document cache. |
Object |
get(Object key)
Throws an exception. |
Iterator |
getAll()
Returns an Iterator over the Objects in the cache. |
Object |
put(Object key,
Object value)
Throws an exception. |
void |
putAll(Map map)
Throws an exception. |
Object |
remove(Object key)
Throws an exception. |
boolean |
removeFromCache(Object o)
Removes the Object o from the document cache, returning true if it was removed. |
boolean |
removeFromCache(String key)
Removes the document specified by the String key from the cache, returning true if it was removed. |
Collection |
values()
Throws an exception. |
| Methods inherited from class java.util.Hashtable |
|---|
clone, contains, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keys, keySet, rehash, size, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_SIZE
public static int hysteresis
| Constructor Detail |
|---|
public Cache()
public Cache(int limit,
boolean autocheck)
| Method Detail |
|---|
protected void addToCache(String key,
Object o)
public Object checkCacheFor(String key)
public boolean removeFromCache(String key)
public boolean removeFromCache(Object o)
public Iterator getAll()
public void clear()
clear in interface Mapclear in class Hashtablepublic void checkLimit()
hysteresis
prior to trimming.
public final Collection values()
getAll() instead.
values in interface Mapvalues in class Hashtablepublic final Object remove(Object key)
removeFromCache(String) instead.
remove in interface Mapremove in class Hashtablepublic final Object get(Object key)
checkCacheFor(String) instead.
get in interface Mapget in class Hashtable
public final Object put(Object key,
Object value)
addToCache(String,Object) instead.
put in interface Mapput in class Hashtablepublic final void putAll(Map map)
addToCache(String,Object) instead.
putAll in interface MapputAll in class Hashtable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||