|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.vignette.portal.cache.CacheStrategy
|
+--com.vignette.portal.cache.ActionBasedCacheStrategy
|
+--com.vignette.portal.cache.SizeBasedStrategy
|
+--com.vignette.portal.cache.FirstInFirstOutStrategy
Removes the oldest entries from the cache when the cache's size is being exceeded.
This strategy only records the order in which keys are added to the cache and therefore incurs very little overhead.
| Constructor Summary | |
FirstInFirstOutStrategy(CacheAction action,
int sizeOfCache)
Creates a cache of specified size with specified action logic. |
|
FirstInFirstOutStrategy(int sizeOfCache)
Creates a cache of specified size with default action logic. |
|
| Method Summary | |
void |
onAdd(Object key,
Object value,
Map properties)
Signals addition to the cache. |
void |
onGet(Object key,
Map properties)
Someone is accessing key in the Cache. |
| Methods inherited from class com.vignette.portal.cache.SizeBasedStrategy |
getSizeOfCache, onInvalidate, onInvalidateAll, onInvalidateAll, onRemove, onRemoveAll, onRemoveAll |
| Methods inherited from class com.vignette.portal.cache.ActionBasedCacheStrategy |
getCacheAction, setStore |
| Methods inherited from class com.vignette.portal.cache.CacheStrategy |
getStore, onAddAll, onGetAll, onPut, onPutAll |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FirstInFirstOutStrategy(int sizeOfCache)
Creates a cache of specified size with default action logic.
sizeOfCache - the maximum number of objects allowed in the cache.SizeBasedStrategy.SizeBasedStrategy(int)
public FirstInFirstOutStrategy(CacheAction action,
int sizeOfCache)
Creates a cache of specified size with specified action logic.
action - the non-null action to invoke when the size of the cache is exceeded.sizeOfCache - the maximum number of objects allowed in the cache.SizeBasedStrategy.SizeBasedStrategy(CacheAction, int)| Method Detail |
public void onGet(Object key,
Map properties)
throws CacheException
CacheStrategySomeone is accessing key in the Cache.
Individual strategies can use the information in
properties to override their creation-time parameters.
onGet in class CacheStrategycom.vignette.portal.cache.CacheStrategykey - item being looked upproperties - possible overrides, can be null
public void onAdd(Object key,
Object value,
Map properties)
CacheStrategySignals addition to the cache. The mapping of key to
value is being inserted in the cache and this strategy
should start monitoring it, if appropriate for its algorithm.
Individual strategies can use the information in
properties to override their creation-time parameters.
This method should not throw any exception since other strategies on the same cache might already have changed their state in response to this signal and the cache will not be able to revert them back to their prior state. The strategies will become out of sync with each other and with the cache, yielding unpredictable behavior.
Perform any validation checks in onPut instead. But note
that another strategy could call this method without calling
onPut first, in which case there is no way to recover
from invalid conditions.
onAdd in class CacheStrategycom.vignette.portal.cache.CacheStrategykey - key being inserted in the cachevalue - value being inserted in the cache, matching keyproperties - possible overrides, can be null
|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||