MCPcopy Create free account
hub / github.com/aws-samples/aws-lambda-extensions / GetCacheExpiry

Function GetCacheExpiry

cache-extension-demo/plugins/utils.go:33–46  ·  view source on GitHub ↗

Return cache expiry timestamp based on "time.Now() + CACHE_EXTENSION_TTL"

()

Source from the content-addressed store, hash-verified

31
32// Return cache expiry timestamp based on "time.Now() + CACHE_EXTENSION_TTL"
33func GetCacheExpiry() time.Time {
34 // Refresh cache is required via environment variable
35 timeOut := os.Getenv(CacheTimeOut)
36 if timeOut == "" {
37 timeOut = "60m"
38 }
39
40 timeOutInMinutes, err := time.ParseDuration(timeOut)
41 if err != nil {
42 panic("Error while converting CACHE_EXTENSION_TTL env variable " + timeOut)
43 }
44
45 return time.Now().Add(timeOutInMinutes)
46}
47
48// Method for pretty printing objects in logs
49func PrettyPrint(v interface{}) string {

Callers 2

GetDataFunction · 0.85
GetParameterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected