|
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.MonitoringStrategy
Tracks calls to a cache's strategies and computes hit ratio. Use this strategy during development to monitor the performance of you cache and fine tune the configuration of the other strategies on that cache.
| Constructor Summary | |
MonitoringStrategy()
|
|
| Method Summary | |
long |
getAddCount()
|
long |
getGetCount()
|
float |
getHitRatio()
|
long |
getInvalidateCount()
|
Collection |
getKeys()
|
long |
getPutCount()
|
long |
getRemoveCount()
|
float |
getUpdateRatio()
|
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. |
void |
onInvalidate(Object key)
Someone wants to remove key from the cache. |
void |
onInvalidateAll()
Someone wants to remove all keys from the cache. |
void |
onPut(Object key,
Object value,
Map properties)
Someone wants to add the pair key / value
to the cache. |
void |
onRemove(Object key)
Signals removal from the cache. |
void |
onRemoveAll()
Signals clearing of the cache. |
| Methods inherited from class com.vignette.portal.cache.CacheStrategy |
getStore, onAddAll, onGetAll, onInvalidateAll, onPutAll, onRemoveAll, setStore |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MonitoringStrategy()
| Method Detail |
public long getPutCount()
public long getGetCount()
public long getInvalidateCount()
public long getAddCount()
public long getRemoveCount()
public float getUpdateRatio()
public float getHitRatio()
public Collection getKeys()
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 onPut(Object key,
Object value,
Map properties)
throws CacheException
CacheStrategySomeone wants to add the pair key / value
to the cache. This strategy can reject the operation by throwing an
exception. The actual addition, if allowed, will be signalled later by
a call to this strategy's onAdd method.
Individual strategies can use the information in
properties to override their creation-time parameters.
onPut in class CacheStrategycom.vignette.portal.cache.CacheStrategykey - key being addedvalue - value being added, matching keyproperties - possible overrides, can be null
public void onInvalidate(Object key)
throws CacheException
CacheStrategySomeone wants to remove key from the cache. This
strategy can reject the operation by throwing an exception. The actual
removal, if allowed, will be signalled later by a call to this
strategy's onRemove method.
onInvalidate in class CacheStrategycom.vignette.portal.cache.CacheStrategykey - key being removed
public void onInvalidateAll()
throws CacheException
CacheStrategySomeone wants to remove all keys from the cache. This strategy can
reject the operation by throwing an exception. The actual removal, if
allowed, will be signalled later by a call to this strategy's
onRemoveAll method.
onInvalidateAll in class CacheStrategy
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 nullpublic void onRemove(Object key)
CacheStrategySignals removal from the cache. The mapping for key is
being removed from the cache and this strategy should stop monitoring
it and clean up, if appropriate for its algorithm.
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 onInvalidate
instead. But note that another strategy could call this method without
calling onInvalidate first, in which case there is no
way to recover from invalid conditions.
onRemove in class CacheStrategycom.vignette.portal.cache.CacheStrategykey - key being removed from the cachepublic void onRemoveAll()
CacheStrategySignals clearing of the cache. All mappings for all keys are being removed from the cache and this strategy should stop monitoring any of them and clean up, if appropriate for its algorithm.
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
onInvalidateAll instead. But note that another
strategy could call this method without calling
onInvalidateAll first, in which case there is no
way to recover from invalid conditions.
onRemoveAll in class CacheStrategy
|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||