Adjust cache to private variable
This commit is contained in:
parent
41605f743a
commit
20b21c0221
3 changed files with 24 additions and 6 deletions
|
@ -51,7 +51,7 @@ func searchIPCtx(next http.Handler) http.Handler {
|
|||
return
|
||||
}
|
||||
|
||||
newipnet, found := geoloc.IPCache.Get(ipnetnum)
|
||||
newipnet, found := geoloc.GetCacheContent(ipnetnum)
|
||||
if found {
|
||||
ipnetnum = newipnet
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ func searchIPCtx(next http.Handler) http.Handler {
|
|||
}
|
||||
|
||||
if !found {
|
||||
geoloc.IPCache.Set(ipnetnum, ipinfo.IPNumFrom, 2*time.Minute)
|
||||
geoloc.SetCacheContent(ipnetnum, ipinfo.IPNumFrom, 2*time.Minute)
|
||||
}
|
||||
}
|
||||
ctx := context.WithValue(r.Context(), keyIPInfo, ipinfo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue