Class SecretCache.Options.Builder
java.lang.Object
codes.grow.packages.awssecretsmanager.secrets.SecretCache.Options.Builder
- Enclosing class:
SecretCache.Options
Builder for
SecretCache.Options.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Validates and builds the options.Injects the clock (tests).Sets the executor of background refreshes (tests may passRunnable::run).maxEntries(int maxEntries) Sets the LRU limit.refreshAheadFactor(double factor) Sets the refresh-ahead factor; 1 disables refresh-ahead.staleWhileRevalidate(Duration window) Sets the stale-while-revalidate window.Sets the time to live.
-
Method Details
-
ttl
Sets the time to live.- Parameters:
ttl- positive duration- Returns:
- this builder
-
maxEntries
Sets the LRU limit.- Parameters:
maxEntries- positive limit- Returns:
- this builder
-
refreshAheadFactor
Sets the refresh-ahead factor; 1 disables refresh-ahead.- Parameters:
factor- value in (0, 1]- Returns:
- this builder
-
staleWhileRevalidate
Sets the stale-while-revalidate window.- Parameters:
window- non-negative duration- Returns:
- this builder
-
clock
Injects the clock (tests).- Parameters:
clock- clock- Returns:
- this builder
-
executor
Sets the executor of background refreshes (tests may passRunnable::run).- Parameters:
executor- executor- Returns:
- this builder
-
build
Validates and builds the options.- Returns:
- the options
- Throws:
IllegalArgumentException- when a value is out of range
-