|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.slide.util.AbstractObjectCache | +--org.apache.slide.util.HashMapObjectCache
Object cache implementation using Keith Visco's HashMap structure.
Field Summary | |
protected HashMap |
cache
Cache structure. |
Fields inherited from class org.apache.slide.util.AbstractObjectCache |
cacheHits, cacheRequests, currentHitRatio, DEFAULT_HIT_RATIO, DEFAULT_SIZE, desiredHitRatio, initialSize, maxSize |
Constructor Summary | |
HashMapObjectCache()
Constructor. |
|
HashMapObjectCache(int initialSize,
int maxSize,
double desiredHitRatio)
Constructor. |
Method Summary | |
void |
clear()
Clear object cache. |
java.lang.Object |
get(java.lang.Object key)
Get the object associated with the key. |
protected int |
getSize()
Get cache size. |
void |
put(java.lang.Object key,
java.lang.Object value)
Add an object to the cache, or overwrite its value. |
void |
remove(java.lang.Object key)
Remove object associated with the given key. |
protected void |
removeSomeObjects()
Removes some elements from the cache. |
protected void |
resize()
Resize cache. |
Methods inherited from class org.apache.slide.util.AbstractObjectCache |
shouldResize |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected HashMap cache
Constructor Detail |
public HashMapObjectCache()
Warning (blinking) : That constructor is to be used really carefully as the cache maximum size is not limited.
public HashMapObjectCache(int initialSize, int maxSize, double desiredHitRatio)
initialSize
- Initial size of the cachemaxSize
- Maximum size of the cachedesiredHitRatio
- Desired cache hit ratioMethod Detail |
public java.lang.Object get(java.lang.Object key)
get
in class AbstractObjectCache
key
- Object's keypublic void put(java.lang.Object key, java.lang.Object value)
put
in class AbstractObjectCache
key
- Object's keyobject
- Object's valuepublic void remove(java.lang.Object key)
remove
in class AbstractObjectCache
key
- Object's keypublic void clear()
clear
in class AbstractObjectCache
protected void removeSomeObjects()
removeSomeObjects
in class AbstractObjectCache
protected int getSize()
getSize
in class AbstractObjectCache
protected void resize()
resize
in class AbstractObjectCache
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |