paramcache

package module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2021 License: MIT Imports: 7 Imported by: 0

README

ParamCache - A Go SSM Parameter Store Cache

ParamCache is used in AWS Go Lambdas when cold booting to save repeated lookups on subsequent invocations. Assumes SSM / AWS Systems Manager is in the same region as the lambda.

Cache configurable via lambda environment variables:

SSM_CACHE_ENABLE string (default "TRUE")

SSM_CACHE_VERBOSE string (default "FALSE")

SSM_CACHE_TIMEOUT int (default 300 seconds)

Usage

import "github.com/dozyio/paramcache"

...

tableName, err := paramcache.GetParameterStoreValue("dynamodb_table_name")
if err != nil {
	//handle error
}
log.Printf("%s\n", *tableName.Parameter.Value)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSSession added in v0.1.4

func AWSSession(s *session.Session) *session.Session

AWSSession create AWS Session for reuse

func GetParameterStoreValue

func GetParameterStoreValue(param string) (*ssm.GetParameterOutput, error)

GetParameterStoreValue returns a string, stringlist or securestring from SSM and caches the value if configured to do so.

Types

type SSMParameterStoreCache

type SSMParameterStoreCache struct {
	Value        *ssm.GetParameterOutput
	CacheExpires int64
}

SSMParameterStoreCache setup

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL