|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.shiftone.cache.policy.AbstractPolicyCache
Class AbstractPolicyCache
Field Summary | |
static int |
SHRINK_DIV
|
Constructor Summary | |
protected |
AbstractPolicyCache(java.lang.String name,
long timeoutMilliSeconds,
int maxSize,
EvictionListener evictionListener)
|
Method Summary | |
void |
addObject(java.lang.Object key,
java.lang.Object cacheObject)
adds an object to the cache |
void |
clear()
This method calls shrinkToSize(0) which will loop through each element, removing them one by one (in order of lease valued to most valued). |
protected abstract CacheNode |
createNode(java.lang.Object key,
java.lang.Object cacheObject)
Create a new node. |
protected abstract void |
delete(CacheNode node)
Remove a node from the cache. |
protected abstract CacheNode |
findNodeByKey(java.lang.Object key)
Method findNodeByKey |
protected abstract CacheNode |
getLeastValuableNode()
This method will execute the cache's onEviction strategy. |
protected int |
getMaxSize()
|
protected java.lang.String |
getName()
|
java.lang.Object |
getObject(java.lang.Object key)
gets the value stored in the cache by it's key, or null if the key is not found. |
protected long |
getTimeoutMilliSeconds()
|
void |
remove(java.lang.Object key)
remove a specific key/value pair from the cache |
abstract void |
removeExpiredElements()
Purge the cache of expired elements. |
protected abstract void |
revalueNode(CacheNode node)
Update the node's value. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.shiftone.cache.Cache |
size |
Field Detail |
public static final int SHRINK_DIV
Constructor Detail |
protected AbstractPolicyCache(java.lang.String name, long timeoutMilliSeconds, int maxSize, EvictionListener evictionListener)
Method Detail |
public final void addObject(java.lang.Object key, java.lang.Object cacheObject)
Cache
addObject
in interface Cache
public final java.lang.Object getObject(java.lang.Object key)
Cache
getObject
in interface Cache
public final void remove(java.lang.Object key)
Cache
remove
in interface Cache
protected java.lang.String getName()
protected final int getMaxSize()
protected final long getTimeoutMilliSeconds()
public void clear()
clear
in interface Cache
protected abstract CacheNode findNodeByKey(java.lang.Object key)
protected abstract void revalueNode(CacheNode node)
protected abstract void delete(CacheNode node)
protected abstract CacheNode getLeastValuableNode()
This method is only called by shrinkToSize();
public abstract void removeExpiredElements()
removeExpiredElements
in interface ReapableCache
protected abstract CacheNode createNode(java.lang.Object key, java.lang.Object cacheObject)
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |