mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-05-15 09:47:09 +02:00
Move to []byte for caching and make it compile
This commit is contained in:
parent
5b6eecc75f
commit
c4181d1206
11 changed files with 63 additions and 43 deletions
|
@ -31,7 +31,7 @@ func (o *Options) getRedirects(giteaClient *gitea.Client, redirectsCache cache.I
|
|||
// Check for cached redirects
|
||||
if cachedValue, ok := redirectsCache.Get(cacheKey); ok {
|
||||
redirects := []Redirect{}
|
||||
err := json.Unmarshal([]byte(cachedValue), redirects)
|
||||
err := json.Unmarshal(cachedValue, redirects)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("could not parse redirects for key %s", cacheKey)
|
||||
// It's okay to continue, the array stays empty.
|
||||
|
@ -68,7 +68,7 @@ func (o *Options) getRedirects(giteaClient *gitea.Client, redirectsCache cache.I
|
|||
if err != nil {
|
||||
log.Error().Err(err).Msgf("could not store redirects for key %s", cacheKey)
|
||||
} else {
|
||||
_ = redirectsCache.Set(cacheKey, string(redirectsJson), redirectsCacheTimeout)
|
||||
_ = redirectsCache.Set(cacheKey, redirectsJson, redirectsCacheTimeout)
|
||||
}
|
||||
}
|
||||
return redirects
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue