Package org.kiwiproject.consul.config
Class CacheConfig.Builder
java.lang.Object
org.kiwiproject.consul.config.CacheConfig.Builder
- Enclosing class:
- CacheConfig
-
Method Summary
Modifier and TypeMethodDescriptionbuild()withBackOffDelay(Duration delay) Sets the back-off delay used in caches.withBackOffDelay(Duration minDelay, Duration maxDelay) Sets a random delay between theminDelayandmaxDelay(inclusive) to occur between retries.Sets the minimum time between two requests for caches.Sets the minimum time between two requests for caches when an empty result is returned.Log refresh errors using custom functionLog refresh errors as errorLog refresh errors as warningwithTimeoutAutoAdjustmentEnabled(boolean enabled) Enable/Disable the automatic adjustment of read timeoutSets the margin of the read timeout for caches.withWatchDuration(Duration delay) Sets the watch duration used in caches.
-
Method Details
-
withWatchDuration
Sets the watch duration used in caches.- Parameters:
delay- the watch duration to use- Returns:
- the Builder instance
- Throws:
IllegalArgumentException- ifdelayis negative.
-
withBackOffDelay
Sets the back-off delay used in caches.- Parameters:
delay- the back-off delay to use- Returns:
- the Builder instance
- Throws:
IllegalArgumentException- ifdelayis negative.
-
withBackOffDelay
Sets a random delay between theminDelayandmaxDelay(inclusive) to occur between retries.- Parameters:
minDelay- the minimum delay between retriesmaxDelay- the maximum delay between retries- Returns:
- the Builder instance
- Throws:
IllegalArgumentException- ifminDelayormaxDelayis negative, or ifminDelayis greater than tomaxDelay.
-
withMinDelayBetweenRequests
Sets the minimum time between two requests for caches.- Parameters:
delay- the minimum time between two requests to use- Returns:
- the Builder instance
-
withMinDelayOnEmptyResult
Sets the minimum time between two requests for caches when an empty result is returned.- Parameters:
delay- the minimum time between two requests to use when an empty result is returned- Returns:
- the Builder instance
-
withTimeoutAutoAdjustmentEnabled
Enable/Disable the automatic adjustment of read timeout- Parameters:
enabled- use true to enable automatic adjustment of read timeout, false to disable- Returns:
- the Builder instance
-
withTimeoutAutoAdjustmentMargin
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.
- Parameters:
margin- the margin of the read timeout to use- Returns:
- the Builder instance
-
withRefreshErrorLoggedAsWarning
Log refresh errors as warning- Returns:
- the Builder instance
-
withRefreshErrorLoggedAsError
Log refresh errors as error- Returns:
- the Builder instance
-
withRefreshErrorLoggedAs
Log refresh errors using custom function- Parameters:
fn- the custom function to use when an error occurs- Returns:
- the Builder instance
-
build
-