Record Class VirtualTree.CacheStats
java.lang.Object
java.lang.Record
cloud.opencode.base.tree.virtual.VirtualTree.CacheStats
- Enclosing class:
VirtualTree<T,ID>
public static record VirtualTree.CacheStats(int currentSize, int maxSize, long loadCount, long cacheHits, long cacheMisses)
extends Record
Cache Statistics
缓存统计
- Since:
- JDK 25, opencode-base-tree V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
ConstructorsConstructorDescriptionCacheStats(int currentSize, int maxSize, long loadCount, long cacheHits, long cacheMisses) Creates an instance of aCacheStatsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thecacheHitsrecord component.longReturns the value of thecacheMissesrecord component.intReturns the value of thecurrentSizerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doublehitRate()Get cache hit rate 获取缓存命中率longReturns the value of theloadCountrecord component.intmaxSize()Returns the value of themaxSizerecord component.final StringtoString()Returns a string representation of this record class.doubleGet cache usage percentage 获取缓存使用率
-
Constructor Details
-
CacheStats
public CacheStats(int currentSize, int maxSize, long loadCount, long cacheHits, long cacheMisses) Creates an instance of aCacheStatsrecord class.- Parameters:
currentSize- the value for thecurrentSizerecord componentmaxSize- the value for themaxSizerecord componentloadCount- the value for theloadCountrecord componentcacheHits- the value for thecacheHitsrecord componentcacheMisses- the value for thecacheMissesrecord component
-
-
Method Details
-
hitRate
public double hitRate()Get cache hit rate 获取缓存命中率- Returns:
- the hit rate | 命中率
-
usagePercentage
public double usagePercentage()Get cache usage percentage 获取缓存使用率- Returns:
- the usage percentage | 使用率
-
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
currentSize
public int currentSize()Returns the value of thecurrentSizerecord component.- Returns:
- the value of the
currentSizerecord component
-
maxSize
public int maxSize()Returns the value of themaxSizerecord component.- Returns:
- the value of the
maxSizerecord component
-
loadCount
public long loadCount()Returns the value of theloadCountrecord component.- Returns:
- the value of the
loadCountrecord component
-
cacheHits
public long cacheHits()Returns the value of thecacheHitsrecord component.- Returns:
- the value of the
cacheHitsrecord component
-
cacheMisses
public long cacheMisses()Returns the value of thecacheMissesrecord component.- Returns:
- the value of the
cacheMissesrecord component
-