|
SolarMetric Kodo JDO 2.4.3 generated on March 27 2003 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.solarmetric.kodo.util.CacheMap
A map that keeps hard references to a fixed number of elements and moves expired references to a soft reference map. Additionally, objects that are pinned are not counted towards the max size of the map.
| Inner classes inherited from class java.util.Map |
|---|
Map.Entry |
| Constructor Summary | |
|---|---|
CacheMap()
Create a new CacheMap with an initial maximum
unpinned object size of 1000. |
|
CacheMap(int size)
Create a new CacheMap with an initial maximum
unpinned object size of size. |
|
CacheMap(int size,
float load)
Create a new CacheMap with an initial maximum
unpinned object size of size and a load factor of
load. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes pinned objects as well as unpinned ones. |
boolean |
containsKey(Object o)
|
boolean |
containsValue(Object o)
|
Set |
entrySet()
|
protected void |
flush()
Remove unpinned items from the end of the LRU cache until the LRU cache size is less than or equal to the maximum. |
Object |
get(Object key)
|
int |
getCacheSize()
Returns the maximum number of unpinned objects to keep hard references to. |
Set |
getPinnedKeys()
Returns the keys to the objects currently pinned into memory. |
boolean |
isEmpty()
|
Set |
keySet()
|
boolean |
pin(Object key)
Locks the key-value pair identified by key
into the map. |
Object |
put(Object key,
Object value)
|
void |
putAll(Map map)
|
Object |
remove(Object key)
If key is pinned into the cache, the pin is
cleared and the object is removed. |
void |
setCacheSize(int size)
Sets the maximum number of unpinned objects to keep hard references to. |
int |
size()
|
boolean |
unpin(Object key)
Removes the key-value pair identified by key from
the set of pinned objects. |
Collection |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
public CacheMap()
CacheMap with an initial maximum
unpinned object size of 1000.public CacheMap(int size)
CacheMap with an initial maximum
unpinned object size of size.
public CacheMap(int size,
float load)
CacheMap with an initial maximum
unpinned object size of size and a load factor of
load.| Method Detail |
public void setCacheSize(int size)
size, then this method will result in the cache
flushing old values.public int getCacheSize()
public Set getPinnedKeys()
public boolean pin(Object key)
Locks the key-value pair identified by key
into the map. Objects pinned into the map are not counted
towards the maximum size of the map, and are never removed
except by explicit calls to remove(java.lang.Object) or clear().
If a key that is not currently in the cache is pinned, it will not be considered pinned once that key is used in the cache.
true if key's value was
pinned into the cache; false if the
key is not in the cache.public boolean unpin(Object key)
key from
the set of pinned objects. This key becomes a candidate for
removal from the LRU map if the map exceeds the maximum size.true if key's value was
unpinned from the cache; false if the
key is not in the cache.protected void flush()
public Object get(Object key)
get in interface Map
public Object put(Object key,
Object value)
put in interface Mappublic void putAll(Map map)
putAll in interface Mappublic Object remove(Object key)
key is pinned into the cache, the pin is
cleared and the object is removed.remove in interface Mappublic void clear()
clear in interface Mappublic int size()
size in interface Mappublic boolean isEmpty()
isEmpty in interface Mappublic boolean containsKey(Object o)
containsKey in interface Mappublic boolean containsValue(Object o)
containsValue in interface Mappublic Set keySet()
keySet in interface Mappublic Collection values()
values in interface Mappublic Set entrySet()
entrySet in interface Map
|
SolarMetric Kodo JDO 2.4.3 generated on March 27 2003 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||