java.io.Serializable duration of time.
Although this class is not declared final, it is not intended for extension. The behavior is undefined when subclasses are created and used.
ExpiryPolicy
| Modifier and Type | Field and Description |
|---|---|
| private final long | durationAmount
How long, in the specified units, the cache entries should live. |
| public static final Duration | ETERNAL
ETERNAL (forever). |
| public static final Duration | FIVE_MINUTES
Five minutes. |
| public static final Duration | ONE_DAY
One day. |
| public static final Duration | ONE_HOUR
One hour. |
| public static final Duration | ONE_MINUTE
One minute. |
| public static final long | serialVersionUID
The serialVersionUID required for |
| public static final Duration | TEN_MINUTES
Ten minutes. |
| public static final Duration | THIRTY_MINUTES
Thirty minutes. |
| private final TimeUnit | timeUnit
The unit of time to specify time in. The minimum time unit is milliseconds. |
| public static final Duration | TWENTY_MINUTES
Twenty minutes. |
| public static final Duration | ZERO
Zero (no time). |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public long | Returns: the adjusted timethe time from which to adjust given the duration time)Calculates the adjusted time (represented in milliseconds from the Epoc) given a specified time in milliseconds (to be adjusted) by the duration. |
| public long | |
| public TimeUnit | |
| public int | |
| public boolean | |
| public boolean |
| durationAmount | back to summary |
|---|---|
| private final long durationAmount How long, in the specified units, the cache entries should live. The lifetime is measured from the cache entry was last accessed or mutated. | |
| ETERNAL | back to summary |
|---|---|
| public static final Duration ETERNAL ETERNAL (forever). | |
| FIVE_MINUTES | back to summary |
|---|---|
| public static final Duration FIVE_MINUTES Five minutes. | |
| ONE_DAY | back to summary |
|---|---|
| public static final Duration ONE_DAY One day. | |
| ONE_HOUR | back to summary |
|---|---|
| public static final Duration ONE_HOUR One hour. | |
| ONE_MINUTE | back to summary |
|---|---|
| public static final Duration ONE_MINUTE One minute. | |
| serialVersionUID | back to summary |
|---|---|
| public static final long serialVersionUID The serialVersionUID required for | |
| TEN_MINUTES | back to summary |
|---|---|
| public static final Duration TEN_MINUTES Ten minutes. | |
| THIRTY_MINUTES | back to summary |
|---|---|
| public static final Duration THIRTY_MINUTES Thirty minutes. | |
| timeUnit | back to summary |
|---|---|
| private final TimeUnit timeUnit The unit of time to specify time in. The minimum time unit is milliseconds. | |
| TWENTY_MINUTES | back to summary |
|---|---|
| public static final Duration TWENTY_MINUTES Twenty minutes. | |
| ZERO | back to summary |
|---|---|
| public static final Duration ZERO Zero (no time). | |
| Duration | back to summary |
|---|---|
| public Duration() Constructs an eternal duration ( | |
| Duration | back to summary |
|---|---|
| public Duration(TimeUnit timeUnit, long durationAmount) Constructs a duration. The eternal duration (
| |
| Duration | back to summary |
|---|---|
| public Duration(long startTime, long endTime) Constructs a If either parameter is
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getAdjustedTime | back to summary |
|---|---|
| public long getAdjustedTime(long time) Calculates the adjusted time (represented in milliseconds from the Epoc) given a specified time in milliseconds (to be adjusted) by the duration. If this instance represents an eternal duration (
| |
| getDurationAmount | back to summary |
|---|---|
| public long getDurationAmount() Obtain the number of TimeUnits in the Duration
| |
| getTimeUnit | back to summary |
|---|---|
| public TimeUnit getTimeUnit() Obtain the TimeUnit for the Duration
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isEternal | back to summary |
|---|---|
| public boolean isEternal() Determines if a
| |
| isZero | back to summary |
|---|---|
| public boolean isZero() Determines if a
| |