MCPcopy Index your code
hub / github.com/FunctionStream/function-stream / parseCacheControl

Function parseCacheControl

admin/client/client.go:583–599  ·  view source on GitHub ↗
(headers http.Header)

Source from the content-addressed store, hash-verified

581type cacheControl map[string]string
582
583func parseCacheControl(headers http.Header) cacheControl {
584 cc := cacheControl{}
585 ccHeader := headers.Get("Cache-Control")
586 for _, part := range strings.Split(ccHeader, ",") {
587 part = strings.Trim(part, " ")
588 if part == "" {
589 continue
590 }
591 if strings.ContainsRune(part, '=') {
592 keyval := strings.Split(part, "=")
593 cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
594 } else {
595 cc[part] = ""
596 }
597 }
598 return cc
599}
600
601// CacheExpires helper function to determine remaining time before repeating a request.
602func CacheExpires(r *http.Response) time.Time {

Callers 1

CacheExpiresFunction · 0.85

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected