public class RefreshableCache<T> extends Object
| Constructor and Description |
|---|
RefreshableCache(Supplier<T> supplier,
long refreshTimeoutMs) |
| Modifier and Type | Method and Description |
|---|---|
T |
get() |
void |
refresh()
Refreshes the cache only if the refresh timeout has expired
|
public RefreshableCache(Supplier<T> supplier, long refreshTimeoutMs)
supplier - The supplier will be called whenever the cache is refreshedrefreshTimeoutMs - The minimum period of time in milliseconds between refreshes. That
is, when refresh() is called but the refreshTimeoutMs is not
expired the cache will not be refreshedpublic T get()
public void refresh()
Copyright © 2022. All rights reserved.