Record Class CacheHealthIndicator.HealthResult

java.lang.Object
java.lang.Record
cloud.opencode.base.cache.spring.CacheHealthIndicator.HealthResult
Record Components:
status - the health status | 健康状态
cacheCount - the number of caches | 缓存数
totalEntries - the total number of entries | 总条目数
overallHitRate - the overall hit rate | 总体命中率
caches - per-cache health details | 各缓存健康详情
error - the error message, if any | 错误消息(如有)
Enclosing class:
CacheHealthIndicator

public static record CacheHealthIndicator.HealthResult(CacheHealthIndicator.Status status, int cacheCount, long totalEntries, double overallHitRate, Map<String, CacheHealthIndicator.CacheHealth> caches, String error) extends Record
Overall health result 整体健康结果
Since:
JDK 25, opencode-base-cache V2.0.4
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • HealthResult

      public HealthResult(CacheHealthIndicator.Status status, int cacheCount, long totalEntries, double overallHitRate, Map<String, CacheHealthIndicator.CacheHealth> caches)
      Creates a HealthResult without error | 创建无错误的健康结果
      Parameters:
      status - the health status | 健康状态
      cacheCount - the number of caches | 缓存数
      totalEntries - the total entries | 总条目数
      overallHitRate - the overall hit rate | 总体命中率
      caches - per-cache health details | 各缓存健康详情
    • HealthResult

      public HealthResult(CacheHealthIndicator.Status status, int cacheCount, long totalEntries, double overallHitRate, Map<String, CacheHealthIndicator.CacheHealth> caches, String error)
      Creates an instance of a HealthResult record class.
      Parameters:
      status - the value for the status record component
      cacheCount - the value for the cacheCount record component
      totalEntries - the value for the totalEntries record component
      overallHitRate - the value for the overallHitRate record component
      caches - the value for the caches record component
      error - the value for the error record component
  • Method Details

    • isHealthy

      public boolean isHealthy()
      Check if healthy 检查是否健康
      Returns:
      true if UP | UP 返回 true
    • toMap

      public Map<String,Object> toMap()
      Convert to map for JSON serialization 转换为 Map 用于 JSON 序列化
      Returns:
      map representation | Map 表示
    • 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.
    • status

      public CacheHealthIndicator.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • cacheCount

      public int cacheCount()
      Returns the value of the cacheCount record component.
      Returns:
      the value of the cacheCount record component
    • totalEntries

      public long totalEntries()
      Returns the value of the totalEntries record component.
      Returns:
      the value of the totalEntries record component
    • overallHitRate

      public double overallHitRate()
      Returns the value of the overallHitRate record component.
      Returns:
      the value of the overallHitRate record component
    • caches

      Returns the value of the caches record component.
      Returns:
      the value of the caches record component
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component