Record Class MultiLevelCache.MultiLevelStats

java.lang.Object
java.lang.Record
cloud.opencode.base.cache.multilevel.MultiLevelCache.MultiLevelStats
Record Components:
totalHits - the total number of hits across all levels | 所有级别的总命中数
totalMisses - the total number of misses | 总未命中数
totalPromotions - the total number of promotions | 总提升数
levelStats - per-level statistics snapshots | 每级统计快照
Enclosing class:
MultiLevelCache<K,V>

public static record MultiLevelCache.MultiLevelStats(long totalHits, long totalMisses, long totalPromotions, Map<String, MultiLevelCache.LevelMetrics.Snapshot> levelStats) extends Record
Multi-level statistics 多级统计
Since:
JDK 25, opencode-base-cache V2.0.5
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • MultiLevelStats

      public MultiLevelStats(long totalHits, long totalMisses, long totalPromotions, Map<String, MultiLevelCache.LevelMetrics.Snapshot> levelStats)
      Creates an instance of a MultiLevelStats record class.
      Parameters:
      totalHits - the value for the totalHits record component
      totalMisses - the value for the totalMisses record component
      totalPromotions - the value for the totalPromotions record component
      levelStats - the value for the levelStats record component
  • Method Details

    • overallHitRate

      public double overallHitRate()
      overallHitRate | overallHitRate
      Returns:
      the result | 结果
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • totalHits

      public long totalHits()
      Returns the value of the totalHits record component.
      Returns:
      the value of the totalHits record component
    • totalMisses

      public long totalMisses()
      Returns the value of the totalMisses record component.
      Returns:
      the value of the totalMisses record component
    • totalPromotions

      public long totalPromotions()
      Returns the value of the totalPromotions record component.
      Returns:
      the value of the totalPromotions record component
    • levelStats

      Returns the value of the levelStats record component.
      Returns:
      the value of the levelStats record component