Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table.addedItem does not need to be a array #40

Closed
ahdong2007 opened this issue Oct 1, 2019 · 1 comment
Closed

table.addedItem does not need to be a array #40

ahdong2007 opened this issue Oct 1, 2019 · 1 comment

Comments

@ahdong2007
Copy link

ahdong2007 commented Oct 1, 2019

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)

}`

@muesli
Copy link
Owner

muesli commented Oct 1, 2019

That's intentional. If you want to use multiple callbacks, you can use AddAddedItemCallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants