Class SecretCache.Options.Builder

java.lang.Object
codes.grow.packages.openbao.secrets.SecretCache.Options.Builder
Enclosing class:
SecretCache.Options

public static final class SecretCache.Options.Builder extends Object
Builder for SecretCache.Options.
  • Method Details

    • ttl

      Sets the time to live.
      Parameters:
      ttl - positive duration
      Returns:
      this builder
    • maxEntries

      public SecretCache.Options.Builder maxEntries(int maxEntries)
      Sets the LRU limit.
      Parameters:
      maxEntries - positive limit
      Returns:
      this builder
    • refreshAheadFactor

      public SecretCache.Options.Builder refreshAheadFactor(double factor)
      Sets the refresh-ahead factor; 1 disables refresh-ahead.
      Parameters:
      factor - value in (0, 1]
      Returns:
      this builder
    • staleWhileRevalidate

      public SecretCache.Options.Builder staleWhileRevalidate(Duration window)
      Sets the stale-while-revalidate window.
      Parameters:
      window - non-negative duration
      Returns:
      this builder
    • clock

      public SecretCache.Options.Builder clock(Clock clock)
      Injects the clock (tests).
      Parameters:
      clock - clock
      Returns:
      this builder
    • executor

      public SecretCache.Options.Builder executor(Executor executor)
      Sets the executor of background refreshes (tests may pass Runnable::run).
      Parameters:
      executor - executor
      Returns:
      this builder
    • build

      public SecretCache.Options build()
      Validates and builds the options.
      Returns:
      the options
      Throws:
      IllegalArgumentException - when a value is out of range