Class CacheMetrics

java.lang.Object
org.nuxeo.ecm.core.cache.CacheWrapper
org.nuxeo.ecm.core.cache.CacheMetrics
All Implemented Interfaces:
Cache, CacheManagement

public class CacheMetrics extends CacheWrapper
  • 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

      protected io.dropwizard.metrics5.Gauge<Long> 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

  • Method Details

    • nameOf

      protected io.dropwizard.metrics5.MetricName nameOf(String name)
    • start

      public void start()
      Description copied from interface: CacheManagement
      Starts this cache.
      Specified by:
      start in interface CacheManagement
      Overrides:
      start in class CacheWrapper
    • stop

      public void stop()
      Description copied from interface: CacheManagement
      Stops this cache and releases related resources.
      Specified by:
      stop in interface CacheManagement
      Overrides:
      stop in class CacheWrapper
    • get

      public Serializable get(String key)
      Description copied from interface: Cache
      Get method to retrieve value from cache Must not raise exception if the key is null, but return null
      Specified by:
      get in interface Cache
      Overrides:
      get in class CacheWrapper
      Parameters:
      key - the string key
      Returns:
      the Serializable value, return null if the key does not exist or if the key is null
    • put

      public void put(String key, Serializable value)
      Description copied from interface: Cache
      Put method to store a Serializable value
      Specified by:
      put in interface Cache
      Overrides:
      put in class CacheWrapper
      Parameters:
      key - the string key, if null, the value will not be stored
      value - the value to store, if null, the value will not be stored
    • computeIfAbsent

      public <V extends Serializable> V computeIfAbsent(String key, Supplier<V> supplier)
      Retrieves the value from the cache and returns it. If the associated value is null, retrieves it from the supplier and 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/put operations.

      Specified by:
      computeIfAbsent in interface Cache
      Overrides:
      computeIfAbsent in class CacheWrapper
      Since:
      2025.20
    • invalidateAll

      public void invalidateAll()
      Description copied from interface: Cache
      Invalidate all key-value stored in the cache
      Specified by:
      invalidateAll in interface Cache
      Overrides:
      invalidateAll in class CacheWrapper