Package com.orbitz.consul.config
Class CacheConfig.Builder
- java.lang.Object
-
- com.orbitz.consul.config.CacheConfig.Builder
-
- Enclosing class:
- CacheConfig
public static class CacheConfig.Builder extends java.lang.Object
-
-
Method Summary
Modifier and Type Method Description CacheConfigbuild()CacheConfig.BuilderwithBackOffDelay(java.time.Duration delay)Sets the back-off delay used in caches.CacheConfig.BuilderwithBackOffDelay(java.time.Duration minDelay, java.time.Duration maxDelay)Sets a random delay between theminDelayandmaxDelay(inclusive) to occur between retries.CacheConfig.BuilderwithMinDelayBetweenRequests(java.time.Duration delay)Sets the minimum time between two requests for caches.CacheConfig.BuilderwithMinDelayOnEmptyResult(java.time.Duration delay)Sets the minimum time between two requests for caches when an empty result is returned.CacheConfig.BuilderwithRefreshErrorLoggedAs(CacheConfig.RefreshErrorLogConsumer fn)Log refresh errors using custom functionCacheConfig.BuilderwithRefreshErrorLoggedAsError()Log refresh errors as errorCacheConfig.BuilderwithRefreshErrorLoggedAsWarning()Log refresh errors as warningCacheConfig.BuilderwithTimeoutAutoAdjustmentEnabled(boolean enabled)Enable/Disable the automatic adjustment of read timeoutCacheConfig.BuilderwithTimeoutAutoAdjustmentMargin(java.time.Duration margin)Sets the margin of the read timeout for caches.
-
-
-
Method Detail
-
withBackOffDelay
public CacheConfig.Builder withBackOffDelay(java.time.Duration delay)
Sets the back-off delay used in caches.- Throws:
java.lang.IllegalArgumentException- ifdelayis negative.
-
withBackOffDelay
public CacheConfig.Builder withBackOffDelay(java.time.Duration minDelay, java.time.Duration maxDelay)
Sets a random delay between theminDelayandmaxDelay(inclusive) to occur between retries.- Throws:
java.lang.IllegalArgumentException- ifminDelayormaxDelayis negative, or ifminDelayis superior tomaxDelay.
-
withMinDelayBetweenRequests
public CacheConfig.Builder withMinDelayBetweenRequests(java.time.Duration delay)
Sets the minimum time between two requests for caches.
-
withMinDelayOnEmptyResult
public CacheConfig.Builder withMinDelayOnEmptyResult(java.time.Duration delay)
Sets the minimum time between two requests for caches when an empty result is returned.
-
withTimeoutAutoAdjustmentEnabled
public CacheConfig.Builder withTimeoutAutoAdjustmentEnabled(boolean enabled)
Enable/Disable the automatic adjustment of read timeout
-
withTimeoutAutoAdjustmentMargin
public CacheConfig.Builder withTimeoutAutoAdjustmentMargin(java.time.Duration margin)
Sets the margin of the read timeout for caches. The margin represents the additional amount of time given to the read timeout, in addition to the wait duration.
-
withRefreshErrorLoggedAsWarning
public CacheConfig.Builder withRefreshErrorLoggedAsWarning()
Log refresh errors as warning
-
withRefreshErrorLoggedAsError
public CacheConfig.Builder withRefreshErrorLoggedAsError()
Log refresh errors as error
-
withRefreshErrorLoggedAs
public CacheConfig.Builder withRefreshErrorLoggedAs(CacheConfig.RefreshErrorLogConsumer fn)
Log refresh errors using custom function
-
build
public CacheConfig build()
-
-