Record Class MetadataAwareValue<V>
java.lang.Object
java.lang.Record
com.loomcache.server.datastructures.mapstore.MetadataAwareValue<V>
- Type Parameters:
V- value type- Record Components:
value- stored valueexpiryEpochMillis- absolute expiration time, or0for no expiry
Value carrier used by metadata-aware map stores.
The expiry timestamp is absolute epoch milliseconds so a value persisted by one map instance can be loaded by a later instance without relying on the previous process' monotonic clock.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMetadataAwareValue(V value, long expiryEpochMillis) Creates an instance of aMetadataAwareValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static <V> MetadataAwareValue<V> expiringAt(V value, Instant expiry) static <V> MetadataAwareValue<V> expiringAtEpochMillis(V value, long expiryEpochMillis) longReturns the value of theexpiryEpochMillisrecord component.booleanfinal inthashCode()Returns a hash code value for this object.booleanisExpired(long nowEpochMillis) static <V> MetadataAwareValue<V> neverExpires(V value) @Nullable LongtoExpiryNanoTime(long nowEpochMillis, long nowNanoTime) final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Field Details
-
NEVER_EXPIRES
public static final long NEVER_EXPIRES- See Also:
-
-
Constructor Details
-
MetadataAwareValue
Creates an instance of aMetadataAwareValuerecord class.- Parameters:
value- the value for thevaluerecord componentexpiryEpochMillis- the value for theexpiryEpochMillisrecord component
-
-
Method Details
-
neverExpires
-
expiringAt
-
expiringAtEpochMillis
-
hasExpiry
public boolean hasExpiry() -
isExpired
public boolean isExpired(long nowEpochMillis) -
toExpiryNanoTime
-
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. -
value
-
expiryEpochMillis
public long expiryEpochMillis()Returns the value of theexpiryEpochMillisrecord component.- Returns:
- the value of the
expiryEpochMillisrecord component
-