disable gob register if cache is not enabled

This commit is contained in:
Lunny Xiao 2015-10-10 10:32:08 +08:00
parent 300379e016
commit 6d9fe27a6d
1 changed files with 6 additions and 4 deletions

View File

@ -664,10 +664,12 @@ func (engine *Engine) autoMapType(v reflect.Value) *core.Table {
if !ok { if !ok {
table = engine.mapType(v) table = engine.mapType(v)
engine.Tables[t] = table engine.Tables[t] = table
if v.CanAddr() { if engine.Cacher != nil {
engine.GobRegister(v.Addr().Interface()) if v.CanAddr() {
} else { engine.GobRegister(v.Addr().Interface())
engine.GobRegister(v.Interface()) } else {
engine.GobRegister(v.Interface())
}
} }
} }
engine.mutex.Unlock() engine.mutex.Unlock()