Record Class ExpirationTask

java.lang.Object
java.lang.Record
com.loomcache.server.lease.ExpirationTask
Record Components:
dsName - the name of the data structure (e.g., "users", "sessions")
key - the cache key to expire
expiresAtNano - the expiration time in nanoseconds (from System.nanoTime())
All Implemented Interfaces:
Comparable<ExpirationTask>

public record ExpirationTask(String dsName, String key, long expiresAtNano) extends Record implements Comparable<ExpirationTask>
Represents a scheduled expiration task for a cache entry.

Contains metadata about when and what should expire in the distributed cache. Used by ExpirationScheduler to track pending expirations.

Since:
1.5
  • Constructor Details

    • ExpirationTask

      public ExpirationTask(String dsName, String key, long expiresAtNano)
      Creates an instance of a ExpirationTask record class.
      Parameters:
      dsName - the value for the dsName record component
      key - the value for the key record component
      expiresAtNano - the value for the expiresAtNano record component
  • Method Details

    • compareTo

      public int compareTo(ExpirationTask other)
      Compares this task to another by expiration time.

      Earlier expirations are considered "less than" later ones. This enables use in priority queues and sorting.

      Specified by:
      compareTo in interface Comparable<ExpirationTask>
      Parameters:
      other - the other ExpirationTask to compare to
      Returns:
      negative if this expires before other, positive if after, 0 if same
    • 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.
    • dsName

      public String dsName()
      Returns the value of the dsName record component.
      Returns:
      the value of the dsName record component
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • expiresAtNano

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