### Get started with AWS Secrets Manager caching client in Go Source: https://github.com/aws/aws-secretsmanager-caching-go/blob/master/README.md Shows how to instantiate the caching client and request a secret. The example is written for an AWS Lambda function and uses the secretcache.New() and GetSecretString methods. ```go // This example shows how an AWS Lambda function can be written // to retrieve a cached secret from AWS Secrets Manager caching // client. package main import ( "github.com/aws/aws-lambda-go/lambda" "github.com/aws/aws-secretsmanager-caching-go/v2/secretcache" ) var( secretCache, _ = secretcache.New() ) func HandleRequest(secretId string) string { result, _ := secretCache.GetSecretString(secretId) // Use secret to connect to secured resource. return "Success" } func main() { lambda.Start(HandleRequest) } ``` -------------------------------- ### Instantiate cache with custom config and client in Go Source: https://github.com/aws/aws-secretsmanager-caching-go/blob/master/README.md Shows how to create a custom Secrets Manager client and CacheConfig, then instantiate the cache with those customizations using functional options. ```go //Create a custom secretsmanager client client := getCustomClient() //Create a custom CacheConfig struct config := secretcache.CacheConfig{ MaxCacheSize: secretcache.DefaultMaxCacheSize + 10, VersionStage: secretcache.DefaultVersionStage, CacheItemTTL: secretcache.DefaultCacheItemTTL, } //Instantiate the cache cache, _ := secretcache.New( func(c *secretcache.Cache) { c.CacheConfig = config }, func(c *secretcache.Cache) { c.Client = client }, ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.