Skip to content

Commit

Permalink
redisext: optimize error string in value cache
Browse files Browse the repository at this point in the history
  • Loading branch information
niubell committed May 21, 2020
1 parent e324451 commit 43a19f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cache/value/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ func (m *Cache) loadValueToCache(ctx context.Context, key interface{}) (data []b
value, err := m.load(ctx, key)
if err != nil {
slog.Warnf(ctx, "%s load err, cache key:%v err:%v", fun, key, err)
data = []byte(err.Error())
data = []byte(`{}`)
expire = constants.CacheDirtyExpireTime

} else {
data, err = json.Marshal(value)
if err != nil {
slog.Errorf(ctx, "%s marshal err, cache key:%v err:%v", fun, key, err)
data = []byte(err.Error())
data = []byte(`{}`)
expire = constants.CacheDirtyExpireTime
}
}
Expand Down

0 comments on commit 43a19f5

Please sign in to comment.