Return cache expiry timestamp based on "time.Now() + CACHE_EXTENSION_TTL"
()
| 31 | |
| 32 | // Return cache expiry timestamp based on "time.Now() + CACHE_EXTENSION_TTL" |
| 33 | func 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 |
| 49 | func PrettyPrint(v interface{}) string { |
no outgoing calls
no test coverage detected