Class SecretCacheConfiguration
java.lang.Object
com.amazonaws.secretsmanager.caching.SecretCacheConfiguration
Cache configuration options such as max cache size, ttl for cached items, etc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default TTL for an item stored in cache before access causing a refresh.static final intThe default cache size.static final StringThe default version stage to use when retrieving secret values. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the SecretCacheConfiguration object. -
Method Summary
Modifier and TypeMethodDescriptionReturns the interface used to hook in-memory cache updates.longReturns the TTL for the cached items.software.amazon.awssdk.services.secretsmanager.SecretsManagerClientReturns the AWS Secrets Manager client that is used for requesting secret values.intReturns the max cache size that should be used for creating the cache.Returns the version stage that is used for requesting secret values.voidsetCacheHook(SecretCacheHook cacheHook) Sets the interface used to hook the in-memory cache.voidsetCacheItemTTL(long cacheItemTTL) Sets the TTL in milliseconds for the cached items.voidsetClient(software.amazon.awssdk.services.secretsmanager.SecretsManagerClient client) Sets the AWS Secrets Manager client that should be used by the cache for requesting secrets.voidsetMaxCacheSize(int maxCacheSize) Sets the max cache size.voidsetVersionStage(String versionStage) Sets the version stage that should be used for requesting secret values from AWS Secrets ManagerwithCacheHook(SecretCacheHook cacheHook) Sets the interface used to hook the in-memory cache.withCacheItemTTL(long cacheItemTTL) Sets the TTL in milliseconds for the cached items.withClient(software.amazon.awssdk.services.secretsmanager.SecretsManagerClient client) Sets the AWS Secrets Manager client that should be used by the cache for requesting secrets.withMaxCacheSize(int maxCacheSize) Sets the max cache size.withVersionStage(String versionStage) Sets the version stage that should be used for requesting secret values from AWS Secrets Manager
-
Field Details
-
DEFAULT_MAX_CACHE_SIZE
public static final int DEFAULT_MAX_CACHE_SIZEThe default cache size.- See Also:
-
DEFAULT_CACHE_ITEM_TTL
public static final long DEFAULT_CACHE_ITEM_TTLThe default TTL for an item stored in cache before access causing a refresh. -
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
Returns the interface used to hook in-memory cache updates.- Returns:
- The object used to hook in-memory cache updates.
-
setCacheHook
Sets the interface used to hook the in-memory cache.- Parameters:
cacheHook- The interface used to hook the in-memory cache.
-
withCacheHook
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
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
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
Returns the version stage that is used for requesting secret values.- Returns:
- The version stage used in requesting secret values.
-
setVersionStage
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
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.
-