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 Summary
ConstructorsConstructorDescriptionHealthResult(CacheHealthIndicator.Status status, int cacheCount, long totalEntries, double overallHitRate, Map<String, CacheHealthIndicator.CacheHealth> caches) Creates a HealthResult without error | 创建无错误的健康结果HealthResult(CacheHealthIndicator.Status status, int cacheCount, long totalEntries, double overallHitRate, Map<String, CacheHealthIndicator.CacheHealth> caches, String error) Creates an instance of aHealthResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecacheCountrecord component.caches()Returns the value of thecachesrecord component.final booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.final inthashCode()Returns a hash code value for this object.booleanCheck if healthy 检查是否健康doubleReturns the value of theoverallHitRaterecord component.status()Returns the value of thestatusrecord component.toMap()Convert to map for JSON serialization 转换为 Map 用于 JSON 序列化final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalEntriesrecord component.
-
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 aHealthResultrecord class.- Parameters:
status- the value for thestatusrecord componentcacheCount- the value for thecacheCountrecord componenttotalEntries- the value for thetotalEntriesrecord componentoverallHitRate- the value for theoverallHitRaterecord componentcaches- the value for thecachesrecord componenterror- the value for theerrorrecord component
-
-
Method Details
-
isHealthy
public boolean isHealthy()Check if healthy 检查是否健康- Returns:
- true if UP | UP 返回 true
-
toMap
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
status
-
cacheCount
public int cacheCount()Returns the value of thecacheCountrecord component.- Returns:
- the value of the
cacheCountrecord component
-
totalEntries
public long totalEntries()Returns the value of thetotalEntriesrecord component.- Returns:
- the value of the
totalEntriesrecord component
-
overallHitRate
public double overallHitRate()Returns the value of theoverallHitRaterecord component.- Returns:
- the value of the
overallHitRaterecord component
-
caches
-
error
-