Question about SetAddedItemCallback
NicholasLiuWei opened this issue · comments
LiuLiu commented
hello
请看如下函数,是不是应该将这这段注释掉
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
Please be aware that we only speak English in this repo. From what I can gather, you're suggesting to remove the first three lines? What's the reasoning behind it?
Double commented
hello
请看如下函数,是不是应该将这这段注释掉
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)
}
Because there is already an AddAddedItemCallback,
SetAddedItemCallback is used to replace the current call back function
因為SetAddedItemCallback 是用來取代 當下設定的 回調函式
如果把那三行註解了就跟AddAddedItemCallback函式一樣 是用來增加函式到回調函式列表
Christian Muehlhaeuser commented
So I guess we can close this one.