public class AccumulationCache extends Object
Constructor and Description |
---|
AccumulationCache(ConcurrentMap<Utils.HistogramKey,AgentDigest> backingStore,
long cacheSize,
com.github.benmanes.caffeine.cache.Ticker ticker)
Constructs a new AccumulationCache instance around
backingStore and builds an in-memory index maintaining
dispatch times in milliseconds for all HistogramKeys in backingStore
Setting cacheSize to 0 disables in-memory caching so the cache only maintains the dispatch time index. |
Modifier and Type | Method and Description |
---|---|
AgentDigest |
compute(Utils.HistogramKey key,
java.util.function.BiFunction<? super Utils.HistogramKey,? super AgentDigest,? extends AgentDigest> remappingFunction)
Attempts to compute a mapping for the specified key and its current mapped value
(or null if there is no current mapping).
|
Runnable |
getResolveTask()
Task to merge the contents of this cache with the corresponding backing store.
|
Iterator<Utils.HistogramKey> |
getRipeDigestsIterator(TimeProvider clock)
Returns an iterator over "ripe" digests ready to be shipped
|
void |
put(Utils.HistogramKey key,
AgentDigest value)
Update
AgentDigest in the cache with another AgentDigest . |
void |
put(Utils.HistogramKey key,
double value,
short compression,
long ttlMillis)
Update
AgentDigest in the cache with a double value. |
void |
put(Utils.HistogramKey key,
Histogram value,
short compression,
long ttlMillis)
Update
AgentDigest in the cache with a Histogram value. |
long |
size()
Returns the number of items in the storage behind the cache
|
public AccumulationCache(ConcurrentMap<Utils.HistogramKey,AgentDigest> backingStore, long cacheSize, @Nullable com.github.benmanes.caffeine.cache.Ticker ticker)
backingStore
and builds an in-memory index maintaining
dispatch times in milliseconds for all HistogramKeys in backingStore
Setting cacheSize to 0 disables in-memory caching so the cache only maintains the dispatch time index.backingStore
- a ConcurrentMap
storing AgentDigestscacheSize
- maximum size of the cacheticker
- a nanosecond-precision time source (topublic void put(Utils.HistogramKey key, @Nonnull AgentDigest value)
AgentDigest
in the cache with another AgentDigest
.key
- histogram keyvalue
- AgentDigest
to be mergedpublic void put(Utils.HistogramKey key, double value, short compression, long ttlMillis)
AgentDigest
in the cache with a double value. If such AgentDigest
does not exist for
the specified key, it will be created with the specified compression and ttlMillis settings.key
- histogram keyvalue
- value to be merged into the AgentDigest
compression
- default compression level for new binsttlMillis
- default time-to-dispatch for new binspublic void put(Utils.HistogramKey key, Histogram value, short compression, long ttlMillis)
AgentDigest
in the cache with a Histogram
value. If such AgentDigest
does not exist
for the specified key, it will be created with the specified compression and ttlMillis settings.key
- histogram keyvalue
- a Histogram
to be merged into the AgentDigest
compression
- default compression level for new binsttlMillis
- default time-to-dispatch in milliseconds for new binspublic Iterator<Utils.HistogramKey> getRipeDigestsIterator(TimeProvider clock)
clock
- a millisecond-precision epoch time sourcepublic AgentDigest compute(Utils.HistogramKey key, java.util.function.BiFunction<? super Utils.HistogramKey,? super AgentDigest,? extends AgentDigest> remappingFunction)
key
- key with which the specified value is to be associatedremappingFunction
- the function to compute a valuepublic long size()
public Runnable getResolveTask()
Copyright © 2017. All rights reserved.