Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or last access. Access time is reset by {@link Cache#get} and {@link Cache#getUnchecked}, but not by operations on the view returned by {@link Cache#asMap}.
When {@code duration} is zero, elements will be evicted immediately after being loaded intothe cache. This has the same effect as invoking {@link #maximumSize maximumSize}{@code (0)}. It can be useful in testing, or to disable caching temporarily without a code change.
Expired entries may be counted by {@link Cache#size}, but will never be visible to read or write operations. Expired entries are currently cleaned up during write operations, or during occasional read operations in the absense of writes; though this behavior may change in the future.
@param duration the length of time after an entry is last accessed that it should beautomatically removed
@param unit the unit that {@code duration} is expressed in
@throws IllegalArgumentException if {@code duration} is negative
@throws IllegalStateException if the time to idle or time to live was already set