org.springframework.data.redis.core
Class TimeoutUtils
java.lang.Object
org.springframework.data.redis.core.TimeoutUtils
public abstract class TimeoutUtils
- extends Object
Helper class featuring methods for calculating Redis timeouts
Method Summary |
static long |
toSeconds(long timeout,
TimeUnit unit)
Converts the given timeout to seconds. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimeoutUtils
public TimeoutUtils()
toSeconds
public static long toSeconds(long timeout,
TimeUnit unit)
- Converts the given timeout to seconds.
Since a 0 timeout blocks some Redis ops indefinitely, this method will
return 1 if the original value is greater than 0 but is truncated to 0 on
conversion.
- Parameters:
timeout
- The timeout to convertunit
- The timeout's unit
- Returns:
- The converted timeout