javax.cache
Class CacheConfiguration.Duration
java.lang.Object
javax.cache.CacheConfiguration.Duration
- Enclosing interface:
- CacheConfiguration
public static class CacheConfiguration.Duration
- extends Object
A time duration.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ETERNAL
public static final CacheConfiguration.Duration ETERNAL
- ETERNAL
CacheConfiguration.Duration
public CacheConfiguration.Duration(TimeUnit timeUnit,
long timeToLive)
- Constructs a duration.
- Parameters:
timeUnit
- the unit of time to specify time in. The minimum time unit is milliseconds.timeToLive
- how long, in the specified units, the cache entries should live. 0 means eternal.
- Throws:
InvalidConfigurationException
- if a TimeUnit less than milliseconds is specified.
NullPointerException
- if timeUnit is null
IllegalArgumentException
- if timeToLive is less than 0
TODO: revisit above exceptions
todo: Change TimeUnit to our own TimeUnit which does not define nano and micro
getTimeUnit
public TimeUnit getTimeUnit()
- Returns:
- the TimeUnit used to specify this duration
getTimeToLive
public long getTimeToLive()
- Returns:
- the number of TimeUnits which quantify this duration
Copyright © 2011. All Rights Reserved.