Record Class CompressedCache.CompressionStats

java.lang.Object
java.lang.Record
cloud.opencode.base.cache.compression.CompressedCache.CompressionStats
Record Components:
algorithm - the compression algorithm | 压缩算法
totalCompressed - total number of compressions | 总压缩次数
totalDecompressed - total number of decompressions | 总解压次数
bytesBeforeCompression - total bytes before compression | 压缩前总字节数
bytesAfterCompression - total bytes after compression | 压缩后总字节数
compressionTimeNanos - total compression time in nanoseconds | 压缩总时间(纳秒)
decompressionTimeNanos - total decompression time in nanoseconds | 解压总时间(纳秒)
Enclosing class:
CompressedCache<K,V>

public static record CompressedCache.CompressionStats(CompressionAlgorithm algorithm, long totalCompressed, long totalDecompressed, long bytesBeforeCompression, long bytesAfterCompression, long compressionTimeNanos, long decompressionTimeNanos) extends Record
Compression statistics record 压缩统计记录
Since:
JDK 25, opencode-base-cache V2.0.5
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • CompressionStats

      public CompressionStats(CompressionAlgorithm algorithm, long totalCompressed, long totalDecompressed, long bytesBeforeCompression, long bytesAfterCompression, long compressionTimeNanos, long decompressionTimeNanos)
      Creates an instance of a CompressionStats record class.
      Parameters:
      algorithm - the value for the algorithm record component
      totalCompressed - the value for the totalCompressed record component
      totalDecompressed - the value for the totalDecompressed record component
      bytesBeforeCompression - the value for the bytesBeforeCompression record component
      bytesAfterCompression - the value for the bytesAfterCompression record component
      compressionTimeNanos - the value for the compressionTimeNanos record component
      decompressionTimeNanos - the value for the decompressionTimeNanos record component
  • Method Details

    • compressionRatio

      public double compressionRatio()
      Get compression ratio (smaller is better) 获取压缩比(越小越好)
      Returns:
      compression ratio | 压缩比
    • bytesSaved

      public long bytesSaved()
      Get space saved in bytes 获取节省的空间(字节)
      Returns:
      bytes saved | 节省的字节数
    • avgCompressionTimeNanos

      public long avgCompressionTimeNanos()
      Get average compression time in nanoseconds 获取平均压缩时间(纳秒)
      Returns:
      average compression time | 平均压缩时间
    • avgDecompressionTimeNanos

      public long avgDecompressionTimeNanos()
      Get average decompression time in nanoseconds 获取平均解压时间(纳秒)
      Returns:
      average decompression time | 平均解压时间
    • 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.
    • algorithm

      public CompressionAlgorithm algorithm()
      Returns the value of the algorithm record component.
      Returns:
      the value of the algorithm record component
    • totalCompressed

      public long totalCompressed()
      Returns the value of the totalCompressed record component.
      Returns:
      the value of the totalCompressed record component
    • totalDecompressed

      public long totalDecompressed()
      Returns the value of the totalDecompressed record component.
      Returns:
      the value of the totalDecompressed record component
    • bytesBeforeCompression

      public long bytesBeforeCompression()
      Returns the value of the bytesBeforeCompression record component.
      Returns:
      the value of the bytesBeforeCompression record component
    • bytesAfterCompression

      public long bytesAfterCompression()
      Returns the value of the bytesAfterCompression record component.
      Returns:
      the value of the bytesAfterCompression record component
    • compressionTimeNanos

      public long compressionTimeNanos()
      Returns the value of the compressionTimeNanos record component.
      Returns:
      the value of the compressionTimeNanos record component
    • decompressionTimeNanos

      public long decompressionTimeNanos()
      Returns the value of the decompressionTimeNanos record component.
      Returns:
      the value of the decompressionTimeNanos record component