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 value.
State can be expired after a duration had passed since either from the last write to the state, or the last call to the function.
Modifier and Type | Class and Description |
---|---|
static class |
Expiration.Mode |
Modifier and Type | Method and Description |
---|---|
java.time.Duration |
duration() |
static Expiration |
expireAfter(java.time.Duration duration,
Expiration.Mode mode)
Returns an
Expiration configuration that has an expiration characteristic based on the
provided expire Expiration.Mode . |
static Expiration |
expireAfterCall(java.time.Duration duration)
Returns an
Expiration configuration that would expire a @duration after the last
invocation of the function. |
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() |
public static Expiration expireAfterWriting(java.time.Duration duration)
Expiration
configuration that would expire a @duration after the last write.duration
- a duration to wait before considering the state expired.public static Expiration expireAfterCall(java.time.Duration duration)
Expiration
configuration that would expire a @duration after the last
invocation of the function.duration
- a duration to wait before considering the state expired.public static Expiration expireAfter(java.time.Duration duration, Expiration.Mode mode)
Expiration
configuration that has an expiration characteristic based on the
provided expire Expiration.Mode
.duration
- a duration to wait before considering the state expired.mode
- the expire mode.public static Expiration none()
public Expiration.Mode mode()
Expiration
configuration.public java.time.Duration duration()
Expiration
configuration.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.