From 211048f3af6626228e85fc02f3d82181cfd665e4 Mon Sep 17 00:00:00 2001 From: Jianglong Date: Sun, 1 Dec 2019 01:03:41 +0800 Subject: [PATCH] Fix incorrect key in concurrent benchmarks --- cache_test.go | 2 +- sharded_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cache_test.go b/cache_test.go index 47a3d53..a528468 100644 --- a/cache_test.go +++ b/cache_test.go @@ -1555,7 +1555,7 @@ func benchmarkCacheGetManyConcurrent(b *testing.B, exp time.Duration) { tc := New(exp, 0) keys := make([]string, n) for i := 0; i < n; i++ { - k := "foo" + strconv.Itoa(n) + k := "foo" + strconv.Itoa(i) keys[i] = k tc.Set(k, "bar", DefaultExpiration) } diff --git a/sharded_test.go b/sharded_test.go index aef8597..c1ce7ab 100644 --- a/sharded_test.go +++ b/sharded_test.go @@ -65,7 +65,7 @@ func benchmarkShardedCacheGetManyConcurrent(b *testing.B, exp time.Duration) { tsc := unexportedNewSharded(exp, 0, 20) keys := make([]string, n) for i := 0; i < n; i++ { - k := "foo" + strconv.Itoa(n) + k := "foo" + strconv.Itoa(i) keys[i] = k tsc.Set(k, "bar", DefaultExpiration) }