| Modifier | Constructor and Description |
|---|---|
protected |
Expiration(long expirationTime,
TimeUnit timeUnit)
Creates new
Expiration. |
| Modifier and Type | Method and Description |
|---|---|
static Expiration |
from(Duration duration)
Creates new
Expiration with the provided Duration. |
static Expiration |
from(long expirationTime,
TimeUnit timeUnit)
Creates new
Expiration with the provided TimeUnit. |
long |
getConverted(TimeUnit targetTimeUnit)
Get the expiration time converted into the desired
targetTimeUnit. |
long |
getExpirationTime()
Get the expiration time.
|
long |
getExpirationTimeInMilliseconds()
Get the expiration time converted into
TimeUnit.MILLISECONDS. |
long |
getExpirationTimeInSeconds()
Get the expiration time converted into
TimeUnit.SECONDS. |
TimeUnit |
getTimeUnit()
Get the time unit for the expiration time.
|
boolean |
isKeepTtl() |
boolean |
isPersistent() |
boolean |
isUnixTimestamp() |
static Expiration |
keepTtl()
Obtain an
Expiration that indicates to keep the existing one. |
static Expiration |
milliseconds(long expirationTime)
Creates new
Expiration with TimeUnit.MILLISECONDS. |
static Expiration |
persistent()
Creates new persistent
Expiration. |
static Expiration |
seconds(long expirationTime)
Creates new
Expiration with TimeUnit.SECONDS. |
static Expiration |
unixTimestamp(long unixTimestamp,
TimeUnit timeUnit)
Creates new
Expiration with the given unix timestamp and TimeUnit. |
protected Expiration(long expirationTime,
@Nullable
TimeUnit timeUnit)
Expiration.expirationTime - can be null. Defaulted to TimeUnit.SECONDStimeUnit - public long getExpirationTimeInMilliseconds()
TimeUnit.MILLISECONDS.public long getExpirationTimeInSeconds()
TimeUnit.SECONDS.public long getExpirationTime()
public TimeUnit getTimeUnit()
public long getConverted(TimeUnit targetTimeUnit)
targetTimeUnit.targetTimeUnit - must not null.IllegalArgumentExceptionpublic static Expiration seconds(long expirationTime)
Expiration with TimeUnit.SECONDS.expirationTime - public static Expiration milliseconds(long expirationTime)
Expiration with TimeUnit.MILLISECONDS.expirationTime - public static Expiration unixTimestamp(long unixTimestamp, TimeUnit timeUnit)
Expiration with the given unix timestamp and TimeUnit.unixTimestamp - the unix timestamp at which the key will expire.timeUnit - must not be null.Expiration.public static Expiration keepTtl()
Expiration that indicates to keep the existing one. Eg. when sending a SET command.
NOTE: Please follow the documentation of the individual commands to see if keepTtl() is
applicable.
public static Expiration from(long expirationTime, @Nullable TimeUnit timeUnit)
Expiration with the provided TimeUnit. Greater units than TimeUnit.SECONDS are
converted to TimeUnit.SECONDS. Units smaller than TimeUnit.MILLISECONDS are converted to
TimeUnit.MILLISECONDS and can lose precision since TimeUnit.MILLISECONDS is the smallest
granularity supported by Redis.expirationTime - timeUnit - can be null. Defaulted to TimeUnit.SECONDSpublic static Expiration from(Duration duration)
Expiration with the provided Duration. Durations with at least
TimeUnit.SECONDS resolution use seconds, durations using milliseconds use TimeUnit.MILLISECONDS
resolution.duration - must not be null.public static Expiration persistent()
Expiration.public boolean isPersistent()
Expiration is set to persistent.public boolean isKeepTtl()
Expiration of existing key should not be modified.public boolean isUnixTimestamp()
Expiration is set to a specified Unix time at which the key will expire.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.