增加反射结果的缓存
This commit is contained in:
parent
8ead62c058
commit
10854957c0
@ -51,7 +51,6 @@ func (rt *ReflectType) Do(dataFlag string, data interface{}) *StructInfo {
|
||||
// 缓存存在, 直接是有缓存结果
|
||||
return cacheResult
|
||||
}
|
||||
|
||||
// 缓存不存在, 解析
|
||||
res := &StructInfo{
|
||||
Flag: dataFlag,
|
||||
@ -64,6 +63,7 @@ func (rt *ReflectType) Do(dataFlag string, data interface{}) *StructInfo {
|
||||
}
|
||||
if reflectType.Kind() != reflect.Struct {
|
||||
// 非结构体,无需反射
|
||||
rt.cacheTable[dataFlag] = res
|
||||
return res
|
||||
}
|
||||
res.IsStruct = true
|
||||
|
Loading…
Reference in New Issue
Block a user