Cache with -1 for unlimited, ResourceS with short and long caching

This commit is contained in:
DanB
2017-09-03 20:12:59 +02:00
parent 7888fe8757
commit ca059c4faa
11 changed files with 159 additions and 122 deletions

View File

@@ -265,8 +265,11 @@ func CopyHour(src, dest time.Time) time.Time {
}
// Parses duration, considers s as time unit if not provided, seconds as float to specify subunits
func ParseDurationWithSecs(durStr string) (time.Duration, error) {
if _, err := strconv.ParseFloat(durStr, 64); err == nil { // Seconds format considered
func ParseDurationWithSecs(durStr string) (d time.Duration, err error) {
if durStr == "" {
return
}
if _, err = strconv.ParseFloat(durStr, 64); err == nil { // Seconds format considered
durStr += "s"
}
return time.ParseDuration(durStr)