02/28/2005
 

com.vignette.portal.cache
Class MonitoringStrategy

java.lang.Object
  |
  +--com.vignette.portal.cache.CacheStrategy
        |
        +--com.vignette.portal.cache.MonitoringStrategy

public class MonitoringStrategy
extends CacheStrategy

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

MonitoringStrategy

public MonitoringStrategy()
Method Detail

getPutCount

public long getPutCount()

getGetCount

public long getGetCount()

getInvalidateCount

public long getInvalidateCount()

getAddCount

public long getAddCount()

getRemoveCount

public long getRemoveCount()

getUpdateRatio

public float getUpdateRatio()

getHitRatio

public float getHitRatio()

getKeys

public Collection getKeys()

onGet

public void onGet(Object key,
                  Map properties)
           throws CacheException
Description copied from class: CacheStrategy

Someone is accessing key in the Cache.

Individual strategies can use the information in properties to override their creation-time parameters.

Overrides:
onGet in class CacheStrategy
Following copied from class: com.vignette.portal.cache.CacheStrategy
Parameters:
key - item being looked up
properties - possible overrides, can be null

onPut

public void onPut(Object key,
                  Object value,
                  Map properties)
           throws CacheException
Description copied from class: CacheStrategy

Someone 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.

Overrides:
onPut in class CacheStrategy
Following copied from class: com.vignette.portal.cache.CacheStrategy
Parameters:
key - key being added
value - value being added, matching key
properties - possible overrides, can be null

onInvalidate

public void onInvalidate(Object key)
                  throws CacheException
Description copied from class: CacheStrategy

Someone 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.

Overrides:
onInvalidate in class CacheStrategy
Following copied from class: com.vignette.portal.cache.CacheStrategy
Parameters:
key - key being removed

onInvalidateAll

public void onInvalidateAll()
                     throws CacheException
Description copied from class: CacheStrategy

Someone 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.

Overrides:
onInvalidateAll in class CacheStrategy

onAdd

public void onAdd(Object key,
                  Object value,
                  Map properties)
Description copied from class: CacheStrategy

Signals 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.

Overrides:
onAdd in class CacheStrategy
Following copied from class: com.vignette.portal.cache.CacheStrategy
Parameters:
key - key being inserted in the cache
value - value being inserted in the cache, matching key
properties - possible overrides, can be null

onRemove

public void onRemove(Object key)
Description copied from class: CacheStrategy

Signals 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.

Overrides:
onRemove in class CacheStrategy
Following copied from class: com.vignette.portal.cache.CacheStrategy
Parameters:
key - key being removed from the cache

onRemoveAll

public void onRemoveAll()
Description copied from class: CacheStrategy

Signals 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.

Overrides:
onRemoveAll in class CacheStrategy

02/28/2005
 

Copyright and Trademark Notices