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

why fastcache not do hashcode collision? #63

Open
ahfuzhang opened this issue Jan 24, 2022 · 1 comment
Open

why fastcache not do hashcode collision? #63

ahfuzhang opened this issue Jan 24, 2022 · 1 comment

Comments

@ahfuzhang
Copy link

in file fastcache.go, func (b *bucket) Set, line 359:
b.m[h] = idx | (b.gen << bucketSizeBits)

I think the code should be:

if oldValue, ok := b.m[h]; ok{
    //do something, or the last key of same hashcode will lost
}

thanks.

@ahfuzhang
Copy link
Author

sorry, I don't see all logic.
If there is a check, clean() will not remove expires data.
But we can still add a hashcode collision check, and tell calller the over write old value.

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

1 participant