Record Class RetentionPolicy.TimeBased
java.lang.Object
java.lang.Record
com.loomcache.server.journal.RetentionPolicy.TimeBased
- Record Components:
maxAge- Maximum age of entries to retain
- All Implemented Interfaces:
RetentionPolicy
- Enclosing interface:
RetentionPolicy
public static record RetentionPolicy.TimeBased(Duration maxAge)
extends Record
implements RetentionPolicy
Time-based retention policy.
Keeps entries that are newer than the specified duration.
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface RetentionPolicy
RetentionPolicy.Composite, RetentionPolicy.SizeBased, RetentionPolicy.TimeBased -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.maxAge()Returns the value of themaxAgerecord component.booleanshouldRetain(JournalEntry entry, long currentTimeNanos) Check if an entry should be retained.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TimeBased
-
-
Method Details
-
shouldRetain
Description copied from interface:RetentionPolicyCheck if an entry should be retained.- Specified by:
shouldRetainin interfaceRetentionPolicy- Parameters:
entry- The entry to checkcurrentTimeNanos- Current time in nanoseconds- Returns:
- true if the entry should be kept, false if it can be removed
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
maxAge
-