java.lang.Object
org.springframework.data.redis.core.types.Expirations<K>
Value Object linking a number of keys to their
Expirations.TimeToLive retaining the order of the original source.
Dedicated higher level methods interpret raw expiration values retrieved from a Redis Client.
persistent()returns keys that do not have an associated time to livemissing()returns keys that do not exist and therefore have no associated time to livettl()returns the ordered list ofexpirationsbased on the raw valuesexpiring()returns the expiring keys along with theirtime to live
- Since:
- 3.5
- Author:
- Christoph Strobl, Mark Paluch
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordCollection of timeouts associated with aTimeUnit.static classExpiration holds time to liveExpirations.TimeToLive.raw()values as returned by a Redis Client. -
Method Summary
Modifier and TypeMethodDescriptionexpirationOf(K key) expiring()keys()missing()static <K> Expirations<K>of(TimeUnit targetUnit, List<K> keys, Expirations.Timeouts timeouts) Factory Method to createExpirationsfrom raw sources provided in a givenTimeUnit.timeUnit()ttl()
-
Method Details
-
of
public static <K> Expirations<K> of(TimeUnit targetUnit, List<K> keys, Expirations.Timeouts timeouts) Factory Method to createExpirationsfrom raw sources provided in a givenTimeUnit.- Type Parameters:
K- the key type used- Parameters:
targetUnit- the actual time unit of the raw timeToLive values.keys- the keys to associated with the raw values in timeToLive. Defines the actual order of entries withinExpirations.timeouts- the raw Redis time to live values.- Returns:
- new instance of
Expirations.
-
persistent
- Returns:
- an ordered set of keys that do not have a time to live.
-
missing
- Returns:
- an ordered set of keys that do not exist and therefore do not have a time to live.
-
ttl
- Returns:
- an ordered set of all
expirationswhere theExpirations.TimeToLive.value()is using theTimeUnitdefined intimeUnit().
-
timeUnit
- Returns:
- the
TimeUnitforexpirationsheld by this instance.
-
expiring
- Returns:
- an ordered
Listofentriescombining keys with their actual time to live.Missingandpersistententries are skipped.
-
keys
- Returns:
- the ordered collection of keys that are associated with an expiration.
-
expirationOf
- Parameters:
key-- Returns:
- the
expirationswhere theExpirations.TimeToLive.value()is using theTimeUnitdefined intimeUnit()or null if no entry could be found.
-
ttlOf
- Parameters:
key-- Returns:
- the time to live value of the requested key if it exists and the expiration is neither
missingnorpersistent, null otherwise.
-