MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / setCacheOf

Function setCacheOf

client/internal/cache/base.go:76–84  ·  view source on GitHub ↗
(c *Cache, k K, v *T)

Source from the content-addressed store, hash-verified

74}
75
76func setCacheOf[T any, K keyType](c *Cache, k K, v *T) {
77 typstr := reflect.ValueOf(v).Type().String()
78 typ := cacheTypesMap[typstr]
79 if typ == 0 {
80 return
81 }
82 key := uint64(typ)<<32 | uint64(k)
83 c.m.Store(key, unsafe.Pointer(v))
84}
85
86func getCacheOf[T any, K keyType](c *Cache, k K) (v *T, ok bool) {
87 typstr := reflect.ValueOf(v).Type().String()

Callers 4

RefreshFriendMethod · 0.85
RefreshGroupMemberMethod · 0.85
RefreshGroupMembersMethod · 0.85
RefreshGroupMethod · 0.85

Calls 2

TypeMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected