public final class Expiration
extends java.lang.Object
implements java.io.Serializable
This class defines the way state can be auto expired by the runtime. State expiration (also
known as state TTL) can be used to keep state from growing arbitrarily by assigning an expiration
date to a PersistedAppendingBuffer
, PersistedValue
or a PersistedTable
.
State can be expired after a duration had passed since either from the last write to the state, or the last read.
Modifier and Type | Class and Description |
---|---|
static class |
Expiration.Mode |
Constructor and Description |
---|
Expiration(Expiration.Mode mode,
java.time.Duration duration) |
Modifier and Type | Method and Description |
---|---|
java.time.Duration |
duration() |
static Expiration |
expireAfter(java.time.Duration duration,
Expiration.Mode mode) |
static Expiration |
expireAfterReadingOrWriting(java.time.Duration duration)
Returns an Expiration configuration that would expire a @duration after the last write or read.
|
static Expiration |
expireAfterWriting(java.time.Duration duration)
Returns an Expiration configuration that would expire a @duration after the last write.
|
Expiration.Mode |
mode() |
static Expiration |
none() |
java.lang.String |
toString() |
@ForRuntime public Expiration(Expiration.Mode mode, java.time.Duration duration)
public static Expiration expireAfterWriting(java.time.Duration duration)
duration
- a duration to wait before considering the state expired.public static Expiration expireAfterReadingOrWriting(java.time.Duration duration)
duration
- a duration to wait before considering the state expired.public static Expiration expireAfter(java.time.Duration duration, Expiration.Mode mode)
public static Expiration none()
public Expiration.Mode mode()
public java.time.Duration duration()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.