-
Notifications
You must be signed in to change notification settings - Fork 602
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
New Get API which returns additional information about the entry #168
Conversation
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 will need functional tests as well. :)
cb85fe3
to
f76359e
Compare
f76359e
to
db8ee07
Compare
@mxplusb I forgot to |
d0eab91
to
9cb87e0
Compare
9cb87e0
to
de79c3d
Compare
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.
I'm okay with this. It's well covered with tests, it's a new API, and it has benchmarks. I can't think of a reason not to add this.
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.
I have only minor styling comments. Then we can merge it.
enhancement: added new data struct Response, which will be returned when calling GetWithInfo(). Caller can use this Response to check the status of the Entry, whether its Expired or not. Default '0' means its still in use. Test: added test case for the api and made sure all tests cases are successful. made sure that testing is above par level BenchMarkCompare old (master) & new (get_api_info) benchmark old allocs new allocs delta BenchmarkWriteToCacheWith1Shard-12 3 3 +0.00% BenchmarkWriteToLimitedCacheWithSmallInitSizeAnd1Shard-12 3 3 +0.00% BenchmarkWriteToUnlimitedCacheWithSmallInitSizeAnd1Shard-12 2 2 +0.00% BenchmarkWriteToCache/1-shards-12 3 3 +0.00% BenchmarkWriteToCache/512-shards-12 3 3 +0.00% BenchmarkWriteToCache/1024-shards-12 3 3 +0.00% BenchmarkWriteToCache/8192-shards-12 3 3 +0.00% BenchmarkReadFromCache/1-shards-12 2 2 +0.00% BenchmarkReadFromCache/512-shards-12 2 2 +0.00% BenchmarkReadFromCache/1024-shards-12 2 2 +0.00% BenchmarkReadFromCache/8192-shards-12 2 2 +0.00% BenchmarkIterateOverCache/512-shards-12 2 2 +0.00% BenchmarkIterateOverCache/1024-shards-12 2 2 +0.00% BenchmarkIterateOverCache/8192-shards-12 2 2 +0.00% BenchmarkWriteToCacheWith1024ShardsAndSmallShardInitSize-12 3 3 +0.00% BenchmarkReadFromCacheNonExistentKeys/1-shards-12 0 0 +0.00% BenchmarkReadFromCacheNonExistentKeys/512-shards-12 0 0 +0.00% BenchmarkReadFromCacheNonExistentKeys/1024-shards-12 0 0 +0.00% BenchmarkReadFromCacheNonExistentKeys/8192-shards-12 0 0 +0.00% benchmark old bytes new bytes delta BenchmarkWriteToCacheWith1Shard-12 579 579 +0.00% BenchmarkWriteToLimitedCacheWithSmallInitSizeAnd1Shard-12 41 41 +0.00% BenchmarkWriteToUnlimitedCacheWithSmallInitSizeAnd1Shard-12 3448 3448 +0.00% BenchmarkWriteToCache/1-shards-12 579 579 +0.00% BenchmarkWriteToCache/512-shards-12 574 573 -0.17% BenchmarkWriteToCache/1024-shards-12 574 574 +0.00% BenchmarkWriteToCache/8192-shards-12 579 579 +0.00% BenchmarkReadFromCache/1-shards-12 271 271 +0.00% BenchmarkReadFromCache/512-shards-12 271 271 +0.00% BenchmarkReadFromCache/1024-shards-12 271 271 +0.00% BenchmarkReadFromCache/8192-shards-12 271 271 +0.00% BenchmarkIterateOverCache/512-shards-12 20 20 +0.00% BenchmarkIterateOverCache/1024-shards-12 20 20 +0.00% BenchmarkIterateOverCache/8192-shards-12 20 20 +0.00% BenchmarkWriteToCacheWith1024ShardsAndSmallShardInitSize-12 1154 1154 +0.00% BenchmarkReadFromCacheNonExistentKeys/1-shards-12 7 7 +0.00% BenchmarkReadFromCacheNonExistentKeys/512-shards-12 7 7 +0.00% BenchmarkReadFromCacheNonExistentKeys/1024-shards-12 7 7 +0.00% BenchmarkReadFromCacheNonExistentKeys/8192-shards-12 7 7 +0.00% Benchmarking Result: GOROOT=/usr/local/Cellar/go@1.12/1.12.9/libexec #gosetup GOPATH=/Users/jaygheewala/.go #gosetup /usr/local/Cellar/go@1.12/1.12.9/libexec/bin/go test -c -o /private/var/folders/tr/0xbgwcsn60l6j_64qlfdxztm0000gp/T/___gobench_github_com_allegro_bigcache_v2 github.com/allegro/bigcache/v2 #gosetup /private/var/folders/tr/0xbgwcsn60l6j_64qlfdxztm0000gp/T/___gobench_github_com_allegro_bigcache_v2 -test.v -test.bench . -test.run ^$ #gosetup goos: darwin goarch: amd64 pkg: github.com/allegro/bigcache/v2 BenchmarkWriteToCacheWith1Shard-12 2000000 694 ns/op 579 B/op 3 allocs/op BenchmarkWriteToLimitedCacheWithSmallInitSizeAnd1Shard-12 3000000 449 ns/op 41 B/op 3 allocs/op BenchmarkWriteToUnlimitedCacheWithSmallInitSizeAnd1Shard-12 1000000 1670 ns/op 3448 B/op 2 allocs/op BenchmarkWriteToCache/1-shards-12 2000000 574 ns/op 579 B/op 3 allocs/op BenchmarkWriteToCache/512-shards-12 10000000 164 ns/op 573 B/op 3 allocs/op BenchmarkWriteToCache/1024-shards-12 10000000 151 ns/op 574 B/op 3 allocs/op BenchmarkWriteToCache/8192-shards-12 10000000 186 ns/op 579 B/op 3 allocs/op BenchmarkReadFromCache/1-shards-12 5000000 324 ns/op 271 B/op 2 allocs/op BenchmarkReadFromCache/512-shards-12 5000000 330 ns/op 271 B/op 2 allocs/op BenchmarkReadFromCache/1024-shards-12 5000000 329 ns/op 271 B/op 2 allocs/op BenchmarkReadFromCache/8192-shards-12 5000000 323 ns/op 271 B/op 2 allocs/op BenchmarkReadFromCacheWithInfo/1-shards-12 5000000 326 ns/op 271 B/op 2 allocs/op BenchmarkReadFromCacheWithInfo/512-shards-12 5000000 330 ns/op 271 B/op 2 allocs/op BenchmarkReadFromCacheWithInfo/1024-shards-12 5000000 327 ns/op 271 B/op 2 allocs/op BenchmarkReadFromCacheWithInfo/8192-shards-12 5000000 322 ns/op 271 B/op 2 allocs/op BenchmarkIterateOverCache/512-shards-12 10000000 244 ns/op 20 B/op 2 allocs/op BenchmarkIterateOverCache/1024-shards-12 10000000 237 ns/op 20 B/op 2 allocs/op BenchmarkIterateOverCache/8192-shards-12 10000000 220 ns/op 20 B/op 2 allocs/op BenchmarkWriteToCacheWith1024ShardsAndSmallShardInitSize-12 10000000 355 ns/op 1154 B/op 3 allocs/op BenchmarkReadFromCacheNonExistentKeys/1-shards-12 10000000 185 ns/op 8 B/op 0 allocs/op BenchmarkReadFromCacheNonExistentKeys/512-shards-12 10000000 191 ns/op 7 B/op 0 allocs/op BenchmarkReadFromCacheNonExistentKeys/1024-shards-12 10000000 189 ns/op 7 B/op 0 allocs/op BenchmarkReadFromCacheNonExistentKeys/8192-shards-12 10000000 190 ns/op 7 B/op 0 allocs/op BenchmarkFnvHashSum64-12 200000000 8.66 ns/op BenchmarkFnvHashStdLibSum64-12 50000000 38.3 ns/op PASS
0885ab7
to
4516797
Compare
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.
LGTM
Thank you @jgheewala |
…egro#168) enhancement: added new data struct Response, which will be returned when calling GetWithInfo(). Caller can use this Response to check the status of the Entry, whether its Expired or not. Default '0' means its still in use.
enhancement: added new data struct Response, which will be returned when
calling GetWithInfo(). Caller can use this Response to check the status
of the Entry, whether its Expired or not. Default '0' means its still
in use.
minor lint changes
Test: added test case for the api and made sure all tests cases are
successful