perf(lanzou): optimize the use of list cache (#2956)

* fix:local sort not cache

* perf(lanzou): Optimize the use of list cache
This commit is contained in:
foxxorcat
2023-01-08 21:31:35 +08:00
committed by GitHub
parent 99a186d01b
commit 2f19d4a834
7 changed files with 117 additions and 33 deletions

View File

@ -175,3 +175,18 @@ func formToMap(from string) map[string]string {
}
return param
}
var regExpirationTime = regexp.MustCompile(`e=(\d+)`)
func GetExpirationTime(url string) (etime time.Duration) {
exps := regExpirationTime.FindStringSubmatch(url)
if len(exps) < 2 {
return
}
timestamp, err := strconv.ParseInt(exps[1], 10, 64)
if err != nil {
return
}
etime = time.Duration(timestamp-time.Now().Unix()) * time.Second
return
}