-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce GetFn and PeekFn methods, for zero-copy access. (#92)
This commit introduces two methods GetFn and PeekFn. These methods provide zero-copy access to cache entries, avoiding allocs unless absolutely necessary. They accept a function, and call it with a slice over the current underlying value of the key in memory. The slice is constrained in length and capacity. The RingBuf struct has been augmented with a Slice() method to support these operations. The only case where these variants allocate is when the value wraps around the ring buffer.
- Loading branch information
Showing
4 changed files
with
145 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters