MCPcopy Index your code
hub / github.com/segmentio/encoding / cacheStore

Function cacheStore

json/codec.go:75–81  ·  view source on GitHub ↗
(typ reflect.Type, cod codec, oldCodecs map[unsafe.Pointer]codec)

Source from the content-addressed store, hash-verified

73}
74
75func cacheStore(typ reflect.Type, cod codec, oldCodecs map[unsafe.Pointer]codec) {
76 newCodecs := make(map[unsafe.Pointer]codec, len(oldCodecs)+1)
77 maps.Copy(newCodecs, oldCodecs)
78 newCodecs[typeid(typ)] = cod
79
80 cache.Store(&newCodecs)
81}
82
83func typeid(t reflect.Type) unsafe.Pointer {
84 return (*iface)(unsafe.Pointer(&t)).ptr

Callers 1

constructCachedCodecFunction · 0.85

Calls 1

typeidFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…