Class CacheStatistics

java.lang.Object
org.apache.maven.impl.cache.CacheStatistics

public class CacheStatistics extends Object
Cache statistics that tracks detailed metrics about cache performance and usage patterns.

This implementation integrates with the improved cache architecture and provides thread-safe statistics tracking with minimal performance overhead.

  • Constructor Details

    • CacheStatistics

      public CacheStatistics()
  • Method Details

    • getTotalRequests

      public long getTotalRequests()
    • getCacheHits

      public long getCacheHits()
    • getCacheMisses

      public long getCacheMisses()
    • getHitRatio

      public double getHitRatio()
    • getMissRatio

      public double getMissRatio()
    • getRequestTypeStatistics

      public Map<String,CacheStatistics.RequestTypeStatistics> getRequestTypeStatistics()
    • getRetentionStatistics

      public Map<CacheRetention,CacheStatistics.RetentionStatistics> getRetentionStatistics()
    • getReferenceTypeStatistics

      public Map<String,CacheStatistics.ReferenceTypeStatistics> getReferenceTypeStatistics()
    • getCacheSizes

      public Map<CacheRetention,Long> getCacheSizes()
    • getCachedExceptions

      public long getCachedExceptions()
    • getKeyEvictions

      public long getKeyEvictions()
      Returns the total number of key evictions across all caches.
    • getValueEvictions

      public long getValueEvictions()
      Returns the total number of value evictions across all caches.
    • getTotalEvictions

      public long getTotalEvictions()
      Returns the total number of evictions (keys + values).
    • getKeyEvictionRatio

      public double getKeyEvictionRatio()
      Returns the ratio of key evictions to total evictions.
    • getValueEvictionRatio

      public double getValueEvictionRatio()
      Returns the ratio of value evictions to total evictions.
    • recordHit

      public void recordHit(String requestType, CacheRetention retention)
      Records a cache hit for the given request type and retention policy.
    • recordMiss

      public void recordMiss(String requestType, CacheRetention retention)
      Records a cache miss for the given request type and retention policy.
    • recordCachedException

      public void recordCachedException()
      Records a cached exception.
    • recordKeyEviction

      public void recordKeyEviction(CacheRetention retention)
      Records a key eviction for the specified retention policy.
    • recordValueEviction

      public void recordValueEviction(CacheRetention retention)
      Records a value eviction for the specified retention policy.
    • registerCacheSizeSupplier

      public void registerCacheSizeSupplier(CacheRetention retention, Supplier<Long> sizeSupplier)
      Registers a cache size supplier for the given retention policy.
    • getKeyEvictionsByRetention

      public Map<CacheRetention,Long> getKeyEvictionsByRetention()
      Returns eviction statistics by retention policy.
    • getValueEvictionsByRetention

      public Map<CacheRetention,Long> getValueEvictionsByRetention()
      Returns value eviction statistics by retention policy.
    • recordCacheCreation

      public void recordCacheCreation(String keyRefType, String valueRefType, CacheRetention retention)
      Records cache creation with specific reference types.
    • recordCacheAccess

      public void recordCacheAccess(String keyRefType, String valueRefType, boolean hit)
      Records cache access for specific reference types.