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 expireexpiresAtNano- 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 Summary
ConstructorsConstructorDescriptionExpirationTask(String dsName, String key, long expiresAtNano) Creates an instance of aExpirationTaskrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ExpirationTask other) Compares this task to another by expiration time.dsName()Returns the value of thedsNamerecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of theexpiresAtNanorecord component.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ExpirationTask
Creates an instance of aExpirationTaskrecord class.- Parameters:
dsName- the value for thedsNamerecord componentkey- the value for thekeyrecord componentexpiresAtNano- the value for theexpiresAtNanorecord component
-
-
Method Details
-
compareTo
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:
compareToin interfaceComparable<ExpirationTask>- Parameters:
other- the other ExpirationTask to compare to- Returns:
- negative if this expires before other, positive if after, 0 if same
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
dsName
-
key
-
expiresAtNano
public long expiresAtNano()Returns the value of theexpiresAtNanorecord component.- Returns:
- the value of the
expiresAtNanorecord component
-