Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug query result cache key is redundant #31

Closed
vuongxuongminh opened this issue May 6, 2022 · 1 comment
Closed

Bug query result cache key is redundant #31

vuongxuongminh opened this issue May 6, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@vuongxuongminh
Copy link
Member

vuongxuongminh commented May 6, 2022

Currently, when using multi varies, query result cache key will be redundant on the same query because loop on the map not guaranteed key position for each request.

gbox/caching_plan.go

Lines 245 to 274 in 998a7f2

for name := range plan.VaryNames {
vary, ok := p.caching.Varies[name]
if !ok {
return "", fmt.Errorf("setting of vary %s does not exist in varies list given", vary)
}
for name := range vary.Headers {
buffString := fmt.Sprintf("header:%s=%s;", name, r.Header.Get(name))
if _, err := hash.Write([]byte(buffString)); err != nil {
return "", err
}
}
for name := range vary.Cookies {
var value string
cookie, err := r.Cookie(name)
if err == nil {
value = cookie.Value
}
buffString := fmt.Sprintf("cookie:%s=%s;", cookie, value)
if _, err := hash.Write([]byte(buffString)); err != nil {
return "", err
}
}
}

@vuongxuongminh vuongxuongminh added the bug Something isn't working label May 6, 2022
@vuongxuongminh
Copy link
Member Author

Resolved by #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants