|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.hq.measurement.server.session.MetricDataCache
public class MetricDataCache
The MetricDataCache caches the last measurement keyed on the derived measurement id. The purpose of this cache is to avoid needing to go to the database when looking up the last value for a metric. If this area of the code becomes a bottleneck, we may want to consider ditching ehcache and just using a straight HashMap -- the code is simpler, and locking straightforward. However, it is currently nice to keep ehcache, as it allows us to configure sizes and get stats.
Method Summary | |
---|---|
protected boolean |
add(java.lang.Integer mid,
MetricValue mval)
Add a MetricValue to the cache. |
java.util.Collection |
bulkAdd(java.util.List data)
Add MetricValues to the cache. |
MetricValue |
get(java.lang.Integer mid,
long timestamp)
Get a MetricValue from the cache. |
java.util.Map |
getAll(java.util.List mids,
long timestamp)
Get MetricValue s from the cache within the specified time range, from timestamp
to currentTimeMillis. |
static MetricDataCache |
getInstance()
|
void |
remove(java.lang.Integer mid)
Remove a MetricValue from cache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static MetricDataCache getInstance()
public java.util.Collection bulkAdd(java.util.List data)
data
- The list of DataPoint objects representing each MetricValue.
protected boolean add(java.lang.Integer mid, MetricValue mval)
bulk add
for batch updates to the cache.
mid
- The measurement id.mval
- The MetricValue to store.
public java.util.Map getAll(java.util.List mids, long timestamp)
MetricValue
s from the cache within the specified time range, from timestamp
to currentTimeMillis.
mids
- List
of Integer
s representing MeasurementIds.timestamp
- the start of the time range (inclusive) in millis.
Map
of Integer
of measurementIds to MetricValue
from the cache. If the mid does not exist or the timestamp of value is out of the
specified window the returned Map will not include any representation of the mid.public MetricValue get(java.lang.Integer mid, long timestamp)
mid
- The measurement id.timestamp
- The beginning of the cache window.
public void remove(java.lang.Integer mid)
mid
- The measurement id to remove.
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |