table.addedItem does not need to be a array
ahdong2007 opened this issue · comments
Mason Hua commented
if table.addedItem is set, we will remove it before we reset it. so table.addedItem will be always just one item, it didn't need to be a array.
table.aboutToDeleteItem is the same.
`func (table *CacheTable) SetAddedItemCallback(f func(*CacheItem)) {
// 如果已存在回调函数,则置空
if len(table.addedItem) > 0 {
table.RemoveAddedItemCallbacks()
}
table.Lock()
defer table.Unlock()
table.addedItem = append(table.addedItem, f)
}`
Christian Muehlhaeuser commented
That's intentional. If you want to use multiple callbacks, you can use AddAddedItemCallback
.