Package org.nuxeo.ecm.core.cache
Class CacheMetrics
java.lang.Object
org.nuxeo.ecm.core.cache.CacheWrapper
org.nuxeo.ecm.core.cache.CacheMetrics
- All Implemented Interfaces:
Cache,CacheManagement
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.dropwizard.metrics5.MetricNameprotected io.dropwizard.metrics5.Counterprotected io.dropwizard.metrics5.Counterprotected io.dropwizard.metrics5.Counterprotected final io.dropwizard.metrics5.MetricNameprotected io.dropwizard.metrics5.RatioGaugeprotected final io.dropwizard.metrics5.MetricNameprotected io.dropwizard.metrics5.Counterprotected final io.dropwizard.metrics5.MetricNameprotected final io.dropwizard.metrics5.MetricNameprotected io.dropwizard.metrics5.MetricRegistryprotected io.dropwizard.metrics5.Gauge<Long>protected final io.dropwizard.metrics5.MetricNameprotected io.dropwizard.metrics5.Counterprotected final io.dropwizard.metrics5.MetricNameFields inherited from class org.nuxeo.ecm.core.cache.CacheWrapper
cache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V extends Serializable>
VcomputeIfAbsent(String key, Supplier<V> supplier) Retrieves the value from the cache and returns it.Get method to retrieve value from cache Must not raise exception if the key is null, but return nullvoidInvalidate all key-value stored in the cacheprotected io.dropwizard.metrics5.MetricNamevoidput(String key, Serializable value) Put method to store aSerializablevaluevoidstart()Starts this cache.voidstop()Stops this cache and releases related resources.Methods inherited from class org.nuxeo.ecm.core.cache.CacheWrapper
getName, getSize, hasEntry, invalidate, invalidateLocal, invalidateLocalAll, keySet, putLocal, toString
-
Field Details
-
registry
protected io.dropwizard.metrics5.MetricRegistry registry -
read
protected io.dropwizard.metrics5.Counter read -
read_hit
protected io.dropwizard.metrics5.Counter read_hit -
read_miss
protected io.dropwizard.metrics5.Counter read_miss -
read_hit_ratio
protected io.dropwizard.metrics5.RatioGauge read_hit_ratio -
write
protected io.dropwizard.metrics5.Counter write -
invalidation
protected io.dropwizard.metrics5.Counter invalidation -
size
-
READ_HIT_NAME
protected final io.dropwizard.metrics5.MetricName READ_HIT_NAME -
READ_HIT_RATIO_NAME
protected final io.dropwizard.metrics5.MetricName READ_HIT_RATIO_NAME -
READ_MISS_NAME
protected final io.dropwizard.metrics5.MetricName READ_MISS_NAME -
READ_NAME
protected final io.dropwizard.metrics5.MetricName READ_NAME -
WRITE_NAME
protected final io.dropwizard.metrics5.MetricName WRITE_NAME -
INVALIDATE_ALL_NAME
protected final io.dropwizard.metrics5.MetricName INVALIDATE_ALL_NAME -
SIZE_NAME
protected final io.dropwizard.metrics5.MetricName SIZE_NAME
-
-
Constructor Details
-
CacheMetrics
-
-
Method Details
-
nameOf
-
start
public void start()Description copied from interface:CacheManagementStarts this cache.- Specified by:
startin interfaceCacheManagement- Overrides:
startin classCacheWrapper
-
stop
public void stop()Description copied from interface:CacheManagementStops this cache and releases related resources.- Specified by:
stopin interfaceCacheManagement- Overrides:
stopin classCacheWrapper
-
get
Description copied from interface:CacheGet method to retrieve value from cache Must not raise exception if the key is null, but return null- Specified by:
getin interfaceCache- Overrides:
getin classCacheWrapper- Parameters:
key- the string key- Returns:
- the
Serializablevalue, return null if the key does not exist or if the key is null
-
put
Description copied from interface:CachePut method to store aSerializablevalue- Specified by:
putin interfaceCache- Overrides:
putin classCacheWrapper- Parameters:
key- the string key, if null, the value will not be storedvalue- the value to store, if null, the value will not be stored
-
computeIfAbsent
Retrieves the value from the cache and returns it. If the associated value is null, retrieves it from thesupplierand put it into the cache.Delegates to the wrapped cache to preserve single-flight loading semantics implemented by the underlying cache.
Records read/hit/miss/write counters around the delegated call so that the loading path is accounted for like direct
get/putoperations.- Specified by:
computeIfAbsentin interfaceCache- Overrides:
computeIfAbsentin classCacheWrapper- Since:
- 2025.20
-
invalidateAll
public void invalidateAll()Description copied from interface:CacheInvalidate all key-value stored in the cache- Specified by:
invalidateAllin interfaceCache- Overrides:
invalidateAllin classCacheWrapper
-