Record Class CacheQuery.Result<K,V>

java.lang.Object
java.lang.Record
cloud.opencode.base.cache.query.CacheQuery.Result<K,V>
Type Parameters:
K - key type | 键类型
V - value type | 值类型
Record Components:
entries - the matched entries | 匹配的条目
totalInCache - the total entries in cache | 缓存中的总条目数
skipped - the number of skipped entries | 跳过的条目数
limit - the query limit | 查询限制
executionTimeNanos - the execution time in nanoseconds | 执行时间(纳秒)
Enclosing class:
CacheQuery<K,V>

public static record CacheQuery.Result<K,V>(List<Map.Entry<K,V>> entries, long totalInCache, long skipped, long limit, long executionTimeNanos) extends Record
Query result containing matched entries and metadata 包含匹配条目和元数据的查询结果
Since:
JDK 25, opencode-base-cache V2.0.5
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • Result

      public Result(List<Map.Entry<K,V>> entries, long totalInCache, long skipped, long limit, long executionTimeNanos)
      Creates an instance of a Result record class.
      Parameters:
      entries - the value for the entries record component
      totalInCache - the value for the totalInCache record component
      skipped - the value for the skipped record component
      limit - the value for the limit record component
      executionTimeNanos - the value for the executionTimeNanos record component
  • Method Details

    • size

      public int size()
      Get result size 获取结果大小
      Returns:
      result size | 结果大小
    • isEmpty

      public boolean isEmpty()
      Check if empty 检查是否为空
      Returns:
      true if empty | 如果为空返回 true
    • keys

      public List<K> keys()
      Get keys only 仅获取键
      Returns:
      list of keys | 键列表
    • values

      public List<V> values()
      Get values only 仅获取值
      Returns:
      list of values | 值列表
    • toMap

      public Map<K,V> toMap()
      Convert to map 转换为 Map
      Returns:
      map of entries | 条目的 Map
    • executionTimeMs

      public double executionTimeMs()
      Get execution time in milliseconds 获取执行时间(毫秒)
      Returns:
      execution time ms | 执行时间毫秒
    • hasMore

      public boolean hasMore()
      Check if there are more results 检查是否有更多结果
      Returns:
      true if more results exist | 如果有更多结果返回 true
    • 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.
    • entries

      public List<Map.Entry<K,V>> entries()
      Returns the value of the entries record component.
      Returns:
      the value of the entries record component
    • totalInCache

      public long totalInCache()
      Returns the value of the totalInCache record component.
      Returns:
      the value of the totalInCache record component
    • skipped

      public long skipped()
      Returns the value of the skipped record component.
      Returns:
      the value of the skipped record component
    • limit

      public long limit()
      Returns the value of the limit record component.
      Returns:
      the value of the limit record component
    • executionTimeNanos

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