javax.cache
Class CacheConfiguration.Duration

java.lang.Object
  extended by javax.cache.CacheConfiguration.Duration
Enclosing interface:
CacheConfiguration

public static class CacheConfiguration.Duration
extends Object

A time duration.


Field Summary
static CacheConfiguration.Duration ETERNAL
          ETERNAL
 
Constructor Summary
CacheConfiguration.Duration(TimeUnit timeUnit, long timeToLive)
          Constructs a duration.
 
Method Summary
 long getTimeToLive()
           
 TimeUnit getTimeUnit()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ETERNAL

public static final CacheConfiguration.Duration ETERNAL
ETERNAL

Constructor Detail

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
Method Detail

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.