(dbItem D)
| 115 | } |
| 116 | |
| 117 | func (oc *collection[T, D]) Add(dbItem D) { |
| 118 | item := oc.cacheItemFactory() |
| 119 | item.reset(dbItem, oc.tool) |
| 120 | oc.lcuuidToItem[dbItem.GetLcuuid()] = item |
| 121 | oc.idToItem[dbItem.GetID()] = item |
| 122 | if oc.extender != nil { |
| 123 | oc.extender.OnAfterAdd(item, dbItem) |
| 124 | } |
| 125 | oc.tool.GetLogFunc()(addToToolMap(oc.resourceType, dbItem.GetLcuuid()), oc.tool.metadata.LogPrefixes) |
| 126 | } |
| 127 | |
| 128 | func (oc *collection[T, D]) Update(dbItem D) { |
| 129 | if existingItem, ok := oc.idToItem[dbItem.GetID()]; ok { |