Record Class TtlDecayPolicy.StepDecay

java.lang.Object
java.lang.Record
cloud.opencode.base.cache.ttl.TtlDecayPolicy.StepDecay
Record Components:
steps - the decay steps | 衰减步骤
All Implemented Interfaces:
TtlDecayPolicy
Enclosing interface:
TtlDecayPolicy

public static record TtlDecayPolicy.StepDecay(TtlDecayPolicy.Step[] steps) extends Record implements TtlDecayPolicy
Step decay implementation 阶梯衰减实现
Since:
JDK 25, opencode-base-cache V2.0.5
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

  • Method Details

    • calculateDecayedTtl

      public Duration calculateDecayedTtl(long accessCount)
      Description copied from interface: TtlDecayPolicy
      Calculate decayed TTL based on access count 根据访问次数计算衰减后的 TTL
      Specified by:
      calculateDecayedTtl in interface TtlDecayPolicy
      Parameters:
      accessCount - number of times entry has been accessed | 条目被访问的次数
      Returns:
      decayed TTL | 衰减后的 TTL
    • initialTtl

      public Duration initialTtl()
      Description copied from interface: TtlDecayPolicy
      Get initial TTL (before any decay) 获取初始 TTL(任何衰减之前)
      Specified by:
      initialTtl in interface TtlDecayPolicy
      Returns:
      initial TTL | 初始 TTL
    • minimumTtl

      public Duration minimumTtl()
      Description copied from interface: TtlDecayPolicy
      Get minimum TTL (floor) 获取最小 TTL(下限)
      Specified by:
      minimumTtl in interface TtlDecayPolicy
      Returns:
      minimum TTL | 最小 TTL
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • steps

      public TtlDecayPolicy.Step[] steps()
      Returns the value of the steps record component.
      Returns:
      the value of the steps record component