-
Notifications
You must be signed in to change notification settings - Fork 393
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
Fix bug, add method Resize #33
base: master
Are you sure you want to change the base?
Conversation
segment.go
Outdated
@@ -114,7 +114,7 @@ func (seg *segment) set(key, value []byte, hashVal uint64, expireSeconds int) (e | |||
match = false | |||
// increase capacity and limit entry len. | |||
for hdr.valCap < hdr.valLen { | |||
hdr.valCap = hdr.valLen | |||
hdr.valCap *= hdr.valCap |
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.
*= 2
@zhangcunli |
cache.go
Outdated
if entry == nil { | ||
break | ||
} | ||
entryCount = atomic.AddInt64(&entryCount, 1) |
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.
Why atomic.AddUint64 ? There is no concurrent access to local variable.
Why this function were changed at all? Can you prove there is a need to change this function?
@zhangcunli any update? |
Modify the ringbuffer resize, ringbuffer_test.go: |
add method Resize
newSize >= oldSize, keep all entry
newSie < oldSize, discard all entry;
bug, case: