Module spring.data.redis
Interface BoundKeyExpirationOperations
public interface BoundKeyExpirationOperations
Key Expiration operations bound to a key.
- Since:
- 3.5
- Author:
- Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionSet time to live for the bound key.default ExpireChanges.ExpiryChangeStateexpire(Expiration expiration) ApplyExpirationto the bound key without any additional constraints.expire(Expiration expiration, ExpirationOptions options) ApplyExpirationto the bound key givenexpiration options.Set the expiration for the bound key as a date timestamp.Get the time to live for the bound key in seconds.getTimeToLive(TimeUnit timeUnit) Get the time to live for the bound key and convert it to the givenTimeUnit.persist()Remove the expiration from the bound key.
-
Method Details
-
expire
ApplyExpirationto the bound key without any additional constraints.- Parameters:
expiration- the expiration definition.- Returns:
- changes to the key. null when used in pipeline / transaction.
-
expire
ApplyExpirationto the bound key givenexpiration options.- Parameters:
expiration- the expiration definition.options- expiration options.- Returns:
- changes to the key. null when used in pipeline / transaction.
-
expire
Set time to live for the bound key.- Parameters:
timeout- the amount of time after which the key will be expired, must not be null.- Returns:
- changes to the key. null when used in pipeline / transaction.
- Throws:
IllegalArgumentException- if the timeout is null.- Since:
- 3.5
- See Also:
-
expireAt
Set the expiration for the bound key as a date timestamp.- Parameters:
expireAt- must not be null.- Returns:
- changes to the key. null when used in pipeline / transaction.
- Throws:
IllegalArgumentException- if the instant is null or too large to represent as aDate.- Since:
- 3.5
- See Also:
-
persist
Remove the expiration from the bound key.- Returns:
- changes to the key. null when used in pipeline / transaction.
- Since:
- 3.5
- See Also:
-
getTimeToLive
Get the time to live for the bound key in seconds.- Returns:
- the actual expirations in seconds for the key. null when used in pipeline / transaction.
- Since:
- 3.5
- See Also:
-
getTimeToLive
Get the time to live for the bound key and convert it to the givenTimeUnit.- Parameters:
timeUnit- must not be null.- Returns:
- the actual expirations for the key in the given time unit. null when used in pipeline / transaction.
- Since:
- 3.5
- See Also:
-