Specifies that active entries are eligible for automatic refresh once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value. The semantics of refreshes are specified in LoadingCache#refresh, and are performed by calling {@link CacheLoader#reload
(long duration, TimeUnit unit)
| 710 | */ |
| 711 | |
| 712 | @GwtIncompatible // To be supported (synchronously). |
| 713 | public CacheBuilder<K, V> refreshAfterWrite(long duration, TimeUnit unit) { |
| 714 | checkNotNull(unit); |
| 715 | checkState(refreshNanos == UNSET_INT, "refresh was already set to %s ns", refreshNanos); |
| 716 | checkArgument(duration > 0, "duration must be positive: %s %s", duration, unit); |
| 717 | this.refreshNanos = unit.toNanos(duration); |
| 718 | return this; |
| 719 | } |
| 720 | |
| 721 | long getRefreshNanos() { |
| 722 | return (refreshNanos == UNSET_INT) ? DEFAULT_REFRESH_NANOS : refreshNanos; |
no test coverage detected