Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

ssm-cache

An in memory cache that provides typed accessors to the SSM Parameter Store, inspired by ssm-cache-python.

Usage

Create a Client

Create a single ssmcache.Client instance for your lambda application. This client should only be initialized once as part of an init() function.

The single argument is the default expiry for cached values. To create a cache whose elements do not expire by default, provide the NoExpiration value.

var cacheClient ssmcache.Client
func init() {
	cacheClient = ssmcache.NewClient(5 * time.Minute)
}

Fetch Value

Default Expiry

  stringVal, stringValErr := cacheClient.GetString("MyParam")
  stringSliceVal, stringSliceValErr := cacheClient.GetStringList("MyParam")
  decryptedStringVal, decryptedStringValErr := cacheClient.GetSecureString("MyParam")

Custom Expiry

  stringVal, stringValErr := cacheClient.GetExpiringString("MyParam", 30*time.Second)
  stringSliceVal, stringSliceValErr := cacheClient.GetExpiringStringList("MyParam", 30*time.Second)
  decryptedStringVal, decryptedStringValErr := cacheClient.GetExpiringSecureString("MyParam", 30*time.Second)

Force Refresh

Use Purge(keyname) to force delete a cached entry and reload the value from SSM.

  stringVal, stringValErr := cacheClient.Purge("MyParam").GetString("MyParam")

Fetch Group

Default Expiry

  paramMap, paramMapErr := cacheClient.GetParameterGroup("StorageKey", "/my/custom/ssm-path")

Custom Expiry

  paramMap, paramMapErr := cacheClient.GetExpiringParameterGroup("StorageKey", "/my/custom/ssm-path")

References

About

SSM Parameter Store cache library

Resources

Releases

No releases published

Packages

No packages published

Languages