|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap
wt.util.Cache
public class Cache
A fixed size, most recently used object cache.
The caches size is set at construction, and only the most recently used
entries are maintained. Each get or put operation makes that entry the
most recently used. When putting new entries, if the cache is full, the
least recently used entry is aged out of the cache.
Supported API: true
Extendable: false
| Nested Class Summary | |
|---|---|
protected class |
wt.util.Cache.CacheEntry
Default implementation of Map.Entry |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
Cache(int size)
Construct a new fixed-size, most-recently-used cache. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the cache. |
Enumeration |
entries()
Deprecated. Replaced by values().iterator()
Supported API: true |
Object |
get(Object key)
Get an entry from the cache. |
Object |
getAndRemove(Object key)
Deprecated. Replaced by remove(Object)
Supported API: true |
Object |
getAndReplace(Object key,
Object value)
Deprecated. Replaced by put(Object,Object)
Supported API: true |
Object |
put(Object key,
Object value)
Put an entry in the cache. |
Object |
remove(Object key)
Remove an entry from the cache. |
String |
toString()
Returns string representation of the cache. |
| Methods inherited from class java.util.AbstractMap |
|---|
clone, equals, hashCode, isEmpty, putAll, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Cache(int size)
size - the maximum number of entries stored in the cache.| Method Detail |
|---|
public Object get(Object key)
get in interface Mapget in class AbstractMapkey - the entry key
public Object put(Object key,
Object value)
put in interface Mapput in class AbstractMapkey - the entry keyvalue - the value to associate with the given key
public Object getAndReplace(Object key,
Object value)
put(Object,Object)
key - the entry keyvalue - the value to associate with the given key
public Object remove(Object key)
remove in interface Mapremove in class AbstractMapkey - the entry keypublic Object getAndRemove(Object key)
remove(Object)
key - the entry key
public void clear()
clear in interface Mapclear in class AbstractMappublic Enumeration entries()
values().iterator()
Enumeration of the values in the cache.
public String toString()
toString in class AbstractMap
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||