Record Class MultiLevelCache.LevelConfig<K,V>

java.lang.Object
java.lang.Record
cloud.opencode.base.cache.multilevel.MultiLevelCache.LevelConfig<K,V>
Type Parameters:
K - the key type | 键类型
V - the value type | 值类型
Record Components:
name - the level name | 级别名称
cache - the cache instance for this level | 此级别的缓存实例
ttl - the time-to-live for this level | 此级别的过期时间
promoteOnHit - whether to promote entries on hit | 命中时是否提升条目
writeEnabled - whether writes are enabled for this level | 此级别是否启用写入
Enclosing class:
MultiLevelCache<K,V>

public static record MultiLevelCache.LevelConfig<K,V>(String name, Cache<K,V> cache, Duration ttl, boolean promoteOnHit, boolean writeEnabled) extends Record
Level configuration 级别配置
Since:
JDK 25, opencode-base-cache V2.0.5
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • LevelConfig

      public LevelConfig(String name, Cache<K,V> cache, Duration ttl, boolean promoteOnHit, boolean writeEnabled)
      Creates an instance of a LevelConfig record class.
      Parameters:
      name - the value for the name record component
      cache - the value for the cache record component
      ttl - the value for the ttl record component
      promoteOnHit - the value for the promoteOnHit record component
      writeEnabled - the value for the writeEnabled record component
  • Method Details

    • builder

      public static <K,V> MultiLevelCache.LevelConfigBuilder<K,V> builder()
      Creates a new level config builder | 创建新的级别配置构建器
      Type Parameters:
      K - the key type | 键类型
      V - the value type | 值类型
      Returns:
      a new builder | 新的构建器
    • 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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • cache

      public Cache<K,V> cache()
      Returns the value of the cache record component.
      Returns:
      the value of the cache record component
    • ttl

      public Duration ttl()
      Returns the value of the ttl record component.
      Returns:
      the value of the ttl record component
    • promoteOnHit

      public boolean promoteOnHit()
      Returns the value of the promoteOnHit record component.
      Returns:
      the value of the promoteOnHit record component
    • writeEnabled

      public boolean writeEnabled()
      Returns the value of the writeEnabled record component.
      Returns:
      the value of the writeEnabled record component