-
Notifications
You must be signed in to change notification settings - Fork 175
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
Support Iterator for fastcache #44
base: master
Are you sure you want to change the base?
Conversation
ehnuje
commented
Jan 31, 2021
- Spawned from Iterator support? #43 - Iterator support?
- I've checked the previous iterator-like implementation, Add VisitAllEntries method to iterate all entries in cache. #3
- This implementation avoids iterating the whole cache from a single function call. Instead, it copies keys from a bucket, not whole keys from a cache. And then it uses the copied key to retrieve the value from the cache.
LTGM! From the looks of it, this is a highly desirable feature and this PR looks pretty solid! |
When the number of traversals I traverse is large enough, it will cause the array to go out of bounds and cause a panic. Can you help me check it out?
|
chunkIdx := idx / chunkSize | ||
chunk := b.chunks[chunkIdx] | ||
|
||
kvLenBuf := chunk[idx : idx+4] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may cause the array to go out of bounds and generate Panic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this line of code may solve the problem, can you help me take a look? idx = idx % chunkSize