public static class ExpiringCachePolicy.Builder
extends java.lang.Object
ExpiringCachePolicy instance.| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
ExpiringCachePolicy.Builder |
asyncRefresh(boolean asyncRefresh)
Sets whether the cache should refresh itself asynchronously or synchronously.
|
ExpiringCachePolicy |
build(ConfigFetcher configFetcher,
ConfigCache cache)
Builds the configured
ExpiringCachePolicy instance. |
ExpiringCachePolicy.Builder |
cacheRefreshIntervalInSeconds(int cacheRefreshIntervalInSeconds)
Sets how long the cache will store its value before fetching the
latest from the network again.
|
public ExpiringCachePolicy.Builder cacheRefreshIntervalInSeconds(int cacheRefreshIntervalInSeconds)
cacheRefreshIntervalInSeconds - the refresh interval value in seconds.public ExpiringCachePolicy.Builder asyncRefresh(boolean asyncRefresh)
If it's set to true reading from the policy will not wait for the refresh to be finished,
instead it returns immediately with the previous stored value.
If it's set to false the policy will wait until the expired
value is being refreshed with the latest configuration.
asyncRefresh - the refresh behavior.public ExpiringCachePolicy build(ConfigFetcher configFetcher, ConfigCache cache)
ExpiringCachePolicy instance.configFetcher - the internal config fetcher.cache - the internal cache.ExpiringCachePolicy instance