|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.AbstractMap
|
+--com.go.trove.util.WrappedCache
A Map that implements a write-through cache to another map. Two maps are supplied: one for caching and one for main storage. WrappedCache is not thread-safe and must be wrapped with Collections.synchronizedMap to be made thread-safe.
| Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
| Constructor Summary | |
WrappedCache(java.util.Map cacheMap,
java.util.Map backingMap)
|
|
| Method Summary | |
void |
clear()
Clears both the cache and backing map. |
boolean |
containsKey(java.lang.Object key)
Returns true if the cache contains the key or else if the backing map contains the key. |
boolean |
containsValue(java.lang.Object value)
Returns true if the cache contains the value or else if the backing map contains the value. |
java.util.Set |
entrySet()
Returns the entry set of the backing map. |
java.lang.Object |
get(java.lang.Object key)
Returns the value from the cache, or if not found, the backing map. |
boolean |
isEmpty()
Returns the empty status of the backing map. |
java.util.Set |
keySet()
Returns the key set of the backing map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Puts the entry into both the cache and backing map. |
java.lang.Object |
remove(java.lang.Object key)
Removes the key from both the cache and backing map. |
int |
size()
Returns the size of the backing map. |
java.util.Collection |
values()
Returns the values of the backing map. |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode, putAll, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode, putAll |
| Constructor Detail |
public WrappedCache(java.util.Map cacheMap,
java.util.Map backingMap)
cacheMap - the cache map should offer fast access, but it should
automatically limit its maximum sizebackingMap - the backingMap will be read from only if the requested
entry isn't in the cache| Method Detail |
public int size()
size in interface java.util.Mapsize in class java.util.AbstractMappublic boolean isEmpty()
isEmpty in interface java.util.MapisEmpty in class java.util.AbstractMappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.MapcontainsKey in class java.util.AbstractMappublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.MapcontainsValue in class java.util.AbstractMappublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Mapget in class java.util.AbstractMap
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mapput in class java.util.AbstractMappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapremove in class java.util.AbstractMappublic void clear()
clear in interface java.util.Mapclear in class java.util.AbstractMappublic java.util.Set keySet()
keySet in interface java.util.MapkeySet in class java.util.AbstractMappublic java.util.Collection values()
values in interface java.util.Mapvalues in class java.util.AbstractMappublic java.util.Set entrySet()
entrySet in interface java.util.MapentrySet in class java.util.AbstractMap
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||