mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
fix issue in Cache Penetration for cache feature of package gdb
This commit is contained in:
@ -552,6 +552,10 @@ func (m *Model) doGetAllBySql(sql string, args ...interface{}) (result Result, e
|
||||
intlog.Error(m.GetCtx(), err)
|
||||
}
|
||||
} else {
|
||||
// In case of Cache Penetration.
|
||||
if result == nil {
|
||||
result = Result{}
|
||||
}
|
||||
if err := cacheObj.Set(cacheKey, result, m.cacheDuration); err != nil {
|
||||
intlog.Error(m.GetCtx(), err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user