gdb returns result when cache set failed
@@ -538,16 +538,16 @@ func (m *Model) doGetAllBySql(sql string, args ...interface{}) (result Result, e
// Cache the result.
if cacheKey != "" && err == nil {
if m.cacheOption.Duration < 0 {
- if _, err = cacheObj.Remove(ctx, cacheKey); err != nil {
- intlog.Errorf(m.GetCtx(), `%+v`, err)
+ if _, errCache := cacheObj.Remove(ctx, cacheKey); errCache != nil {
+ intlog.Errorf(m.GetCtx(), `%+v`, errCache)
}
} else {
// In case of Cache Penetration.
if result.IsEmpty() && m.cacheOption.Force {
result = Result{}
}
- if err = cacheObj.Set(ctx, cacheKey, result, m.cacheOption.Duration); err != nil {
- intlog.Errorf(m.GetCtx(), `%+v`, err)
+ if errCache := cacheObj.Set(ctx, cacheKey, result, m.cacheOption.Duration); errCache != nil {
+ intlog.Errorf(m.GetCtx(), `%+v`, errCache)
}
}
}
