1 Star 2 Fork 0

api-go/iris

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
util.go 494 Bytes
Copy Edit Raw Blame History
package entry
import (
"regexp"
"strconv"
)
var maxAgeExp = regexp.MustCompile(`maxage=(\d+)`)
// ParseMaxAge parses the max age from the receiver parameter, "cache-control" header
// returns seconds as int64
// if header not found or parse failed then it returns -1
func ParseMaxAge(header string) int64 {
if header == "" {
return -1
}
m := maxAgeExp.FindStringSubmatch(header)
if len(m) == 2 {
if v, err := strconv.Atoi(m[1]); err == nil {
return int64(v)
}
}
return -1
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/netscript/iris.git
git@gitee.com:netscript/iris.git
netscript
iris
iris
v8.4.3

Search