Class SecretCacheConfiguration

java.lang.Object
com.amazonaws.secretsmanager.caching.SecretCacheConfiguration

public class SecretCacheConfiguration extends Object
Cache configuration options such as max cache size, ttl for cached items, etc.
  • Field Details

    • DEFAULT_MAX_CACHE_SIZE

      public static final int DEFAULT_MAX_CACHE_SIZE
      The default cache size.
      See Also:
    • DEFAULT_CACHE_ITEM_TTL

      public static final long DEFAULT_CACHE_ITEM_TTL
      The default TTL for an item stored in cache before access causing a refresh.
    • DEFAULT_VERSION_STAGE

      public static final String DEFAULT_VERSION_STAGE
      The default version stage to use when retrieving secret values.
      See Also:
  • Constructor Details

    • SecretCacheConfiguration

      public SecretCacheConfiguration()
      Default constructor for the SecretCacheConfiguration object.
  • Method Details

    • getClient

      public software.amazon.awssdk.services.secretsmanager.SecretsManagerClient getClient()
      Returns the AWS Secrets Manager client that is used for requesting secret values.
      Returns:
      The AWS Secrets Manager client.
    • setClient

      public void setClient(software.amazon.awssdk.services.secretsmanager.SecretsManagerClient client)
      Sets the AWS Secrets Manager client that should be used by the cache for requesting secrets.
      Parameters:
      client - The AWS Secrets Manager client.
    • withClient

      public SecretCacheConfiguration withClient(software.amazon.awssdk.services.secretsmanager.SecretsManagerClient client)
      Sets the AWS Secrets Manager client that should be used by the cache for requesting secrets.
      Parameters:
      client - The AWS Secrets Manager client.
      Returns:
      The updated ClientConfiguration object with the new client setting.
    • getCacheHook

      public SecretCacheHook getCacheHook()
      Returns the interface used to hook in-memory cache updates.
      Returns:
      The object used to hook in-memory cache updates.
    • setCacheHook

      public void setCacheHook(SecretCacheHook cacheHook)
      Sets the interface used to hook the in-memory cache.
      Parameters:
      cacheHook - The interface used to hook the in-memory cache.
    • withCacheHook

      public SecretCacheConfiguration withCacheHook(SecretCacheHook cacheHook)
      Sets the interface used to hook the in-memory cache.
      Parameters:
      cacheHook - The interface used to hook in-memory cache.
      Returns:
      The updated ClientConfiguration object with the new setting.
    • getMaxCacheSize

      public int getMaxCacheSize()
      Returns the max cache size that should be used for creating the cache.
      Returns:
      The max cache size.
    • setMaxCacheSize

      public void setMaxCacheSize(int maxCacheSize)
      Sets the max cache size.
      Parameters:
      maxCacheSize - The max cache size.
    • withMaxCacheSize

      public SecretCacheConfiguration withMaxCacheSize(int maxCacheSize)
      Sets the max cache size.
      Parameters:
      maxCacheSize - The max cache size.
      Returns:
      The updated ClientConfiguration object with the new max setting.
    • getCacheItemTTL

      public long getCacheItemTTL()
      Returns the TTL for the cached items.
      Returns:
      The TTL in milliseconds before refreshing cached items.
    • setCacheItemTTL

      public void setCacheItemTTL(long cacheItemTTL)
      Sets the TTL in milliseconds for the cached items. Once cached items exceed this TTL, the item will be refreshed using the AWS Secrets Manager client.
      Parameters:
      cacheItemTTL - The TTL for cached items before requiring a refresh.
    • withCacheItemTTL

      public SecretCacheConfiguration withCacheItemTTL(long cacheItemTTL)
      Sets the TTL in milliseconds for the cached items. Once cached items exceed this TTL, the item will be refreshed using the AWS Secrets Manager client.
      Parameters:
      cacheItemTTL - The TTL for cached items before requiring a refresh.
      Returns:
      The updated ClientConfiguration object with the new TTL setting.
    • getVersionStage

      public String getVersionStage()
      Returns the version stage that is used for requesting secret values.
      Returns:
      The version stage used in requesting secret values.
    • setVersionStage

      public void setVersionStage(String versionStage)
      Sets the version stage that should be used for requesting secret values from AWS Secrets Manager
      Parameters:
      versionStage - The version stage used for requesting secret values.
    • withVersionStage

      public SecretCacheConfiguration withVersionStage(String versionStage)
      Sets the version stage that should be used for requesting secret values from AWS Secrets Manager
      Parameters:
      versionStage - The version stage used for requesting secret values.
      Returns:
      The updated ClientConfiguration object with the new version stage setting.