Module spring.data.redis
Class Expirations.TimeToLive
java.lang.Object
org.springframework.data.redis.core.types.Expirations.TimeToLive
- Enclosing class:
- Expirations<K>
Expiration holds time to live
raw() values as returned by a Redis Client. value() serves the
actual timeout in the given temporal context converting the raw() value into a target TimeUnit.
Dedicated methods such as isPersistent() allow interpretation of the raw result. MISSING and
PERSISTENT mark predefined states returned by Redis indicating a time to live value could not be retrieved
due to various reasons.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Expirations.TimeToLivePredefinedExpirations.TimeToLivefor a key that does not exist and therefore does not have a time to live.static Expirations.TimeToLivePredefinedExpirations.TimeToLivefor a key that exists but does not expire. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanbooleanstatic Expirations.TimeToLiveFactory method for creatingExpirations.TimeToLiveinstances, returning predefined ones if the value matches a known reserved state.longraw()The raw source value as returned by the Redis Client.toString()longvalue()
-
Field Details
-
MISSING
PredefinedExpirations.TimeToLivefor a key that does not exist and therefore does not have a time to live. -
PERSISTENT
PredefinedExpirations.TimeToLivefor a key that exists but does not expire.
-
-
Method Details
-
of
Factory method for creatingExpirations.TimeToLiveinstances, returning predefined ones if the value matches a known reserved state.- Parameters:
value- the TTL value.timeUnit- time unit for the given value.- Returns:
- the
Expirations.TimeToLivefor the given raw value.
-
raw
public long raw()The raw source value as returned by the Redis Client.- Returns:
- the raw data.
-
value
public long value() -
convert
- Parameters:
timeUnit- must not be null.- Returns:
- the
Expirations.TimeToLiveinstance with new targetTimeUnitset for obtaining thevalue, or the same instance raw value cannot or must not be converted.
-
isPersistent
public boolean isPersistent()- Returns:
- true if key exists but does not expire.
-
isMissing
public boolean isMissing()- Returns:
- true if key does not exist and therefore does not have a time to live.
-
equals
-
hashCode
public int hashCode() -
toString
-