MCPcopy Create free account
hub / github.com/blues/note / cachedTypeFields

Function cachedTypeFields

jsonxt/encode.go:1268–1274  ·  view source on GitHub ↗

map[reflect.Type][]field cachedTypeFields is like typeFields but uses a cache to avoid repeated work.

(t reflect.Type)

Source from the content-addressed store, hash-verified

1266
1267// cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
1268func cachedTypeFields(t reflect.Type) []field {
1269 if f, ok := fieldCache.Load(t); ok {
1270 return f.([]field)
1271 }
1272 f, _ := fieldCache.LoadOrStore(t, typeFields(t))
1273 return f.([]field)
1274}

Callers 2

newStructEncoderFunction · 0.85
objectMethod · 0.85

Calls 1

typeFieldsFunction · 0.85

Tested by

no test coverage detected