From b205f45f519119bc08be63ef400e86732ad768b8 Mon Sep 17 00:00:00 2001 From: Pranjal Pandit Date: Tue, 13 Sep 2016 13:44:46 +0530 Subject: [PATCH] make sharded cache unexported back again --- sharded.go | 2 +- sharded_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sharded.go b/sharded.go index 7df0943..04f59a9 100644 --- a/sharded.go +++ b/sharded.go @@ -178,7 +178,7 @@ func newShardedCache(n int, de time.Duration) *shardedCache { return sc } -func NewSharded(defaultExpiration, cleanupInterval time.Duration, shards int) *unexportedShardedCache { +func newSharded(defaultExpiration, cleanupInterval time.Duration, shards int) *unexportedShardedCache { if defaultExpiration == 0 { defaultExpiration = -1 } diff --git a/sharded_test.go b/sharded_test.go index 384ed59..d1c34fc 100644 --- a/sharded_test.go +++ b/sharded_test.go @@ -27,7 +27,7 @@ var shardedKeys = []string{ } func TestShardedCache(t *testing.T) { - tc := NewSharded(DefaultExpiration, 0, 13) + tc := newSharded(DefaultExpiration, 0, 13) for _, v := range shardedKeys { tc.Set(v, "value", DefaultExpiration) } @@ -43,7 +43,7 @@ func BenchmarkShardedCacheGetNotExpiring(b *testing.B) { func benchmarkShardedCacheGet(b *testing.B, exp time.Duration) { b.StopTimer() - tc := NewSharded(exp, 0, 10) + tc := newSharded(exp, 0, 10) tc.Set("foobarba", "zquux", DefaultExpiration) b.StartTimer() for i := 0; i < b.N; i++ { @@ -62,7 +62,7 @@ func BenchmarkShardedCacheGetManyConcurrentNotExpiring(b *testing.B) { func benchmarkShardedCacheGetManyConcurrent(b *testing.B, exp time.Duration) { b.StopTimer() n := 10000 - tsc := NewSharded(exp, 0, 20) + tsc := newSharded(exp, 0, 20) keys := make([]string, n) for i := 0; i < n; i++ { k := "foo" + strconv.Itoa(n)