config rework to handle distributed setup, fixed redis bugs

This commit is contained in:
David Zhao
2021-01-17 17:06:50 -08:00
parent 30e99e8c6b
commit 458241d1f1
21 changed files with 382 additions and 104 deletions
+3 -2
View File
@@ -6,6 +6,7 @@ import (
"github.com/go-redis/redis/v8"
"github.com/karlseguin/ccache/v2"
"github.com/pkg/errors"
)
const (
@@ -34,7 +35,7 @@ func (r *CachedRedis) CachedHGet(key, hashKey string) (string, error) {
}
val, err := r.rc.HGet(r.ctx, key, hashKey).Result()
if err != nil {
return "", err
return "", errors.Wrapf(err, "could not hget %s[%s]", key, hashKey)
}
r.cache.Set(key, val, defaultCacheTTL)
return val, nil
@@ -47,7 +48,7 @@ func (r *CachedRedis) CachedGet(key string) (string, error) {
}
val, err := r.rc.Get(r.ctx, key).Result()
if err != nil {
return "", err
return "", errors.Wrapf(err, "could not get %s", key)
}
r.cache.Set(key, val, defaultCacheTTL)