|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.slide.util.AbstractObjectCache
Object cache abstract implementation.
| Field Summary | |
protected double |
cacheHits
Number of cache hits. |
protected double |
cacheRequests
Number of cache requests. |
protected double |
currentHitRatio
Current cache hit ratio. |
protected static double |
DEFAULT_HIT_RATIO
Default desired hit ratio. |
protected static int |
DEFAULT_SIZE
Default cache size. |
protected double |
desiredHitRatio
Desired hit ratio. |
protected int |
initialSize
Initial cache size. |
protected int |
maxSize
Maximum cache size. |
| Constructor Summary | |
AbstractObjectCache()
Constructor. |
|
AbstractObjectCache(int initialSize,
int maxSize,
double desiredHitRatio)
Constructor. |
|
| Method Summary | |
abstract void |
clear()
Clear object cache. |
abstract java.lang.Object |
get(java.lang.Object key)
Get the object associated with the key. |
protected abstract int |
getSize()
Get cache size. |
abstract void |
put(java.lang.Object key,
java.lang.Object value)
Add an object to the cache, or overwrite its value. |
abstract void |
remove(java.lang.Object key)
Remove object associated with the given key. |
protected abstract void |
removeSomeObjects()
Removes some elements from the cache. |
protected abstract void |
resize()
Resize cache. |
protected void |
shouldResize()
Is the cache size too small ? |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int DEFAULT_SIZE
protected static final double DEFAULT_HIT_RATIO
protected int initialSize
protected double desiredHitRatio
protected int maxSize
protected double cacheRequests
protected double cacheHits
protected double currentHitRatio
| Constructor Detail |
public AbstractObjectCache()
Warning (blinking) : That constructor is to be used really carefully as the cache maximum size is not limited.
public AbstractObjectCache(int initialSize,
int maxSize,
double desiredHitRatio)
initialSize - Initial size of the cachemaxSize - Maximum size of the cachedesiredHitRatio - Desired cache hit ratio| Method Detail |
public abstract java.lang.Object get(java.lang.Object key)
get in interface ObjectCachekey - Object's key
public abstract void put(java.lang.Object key,
java.lang.Object value)
put in interface ObjectCachekey - Object's keyvalue - Object's valuepublic abstract void remove(java.lang.Object key)
remove in interface ObjectCachekey - Object's keypublic abstract void clear()
clear in interface ObjectCacheprotected abstract void removeSomeObjects()
protected abstract int getSize()
protected abstract void resize()
protected void shouldResize()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||