From 63991427871ebd11ba924b3747c6bf129c72ee1e Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Tue, 1 Dec 2015 09:12:35 +0100 Subject: [PATCH] added large cache test --- cache_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cache_test.go b/cache_test.go index f998d43..fd9ccb5 100644 --- a/cache_test.go +++ b/cache_test.go @@ -1615,3 +1615,18 @@ func BenchmarkDeleteExpired(b *testing.B) { tc.DeleteExpired() } } + +func BenchmarkLargeCache(b *testing.B) { + b.StopTimer() + tc := New(200 * time.Millisecond, 50 * time.Millisecond) + //tc.mu.Lock() + for i := 0; i < 100000; i++ { + tc.Set(strconv.Itoa(i), "bar", DefaultExpiration) + } + //tc.mu.Unlock() + tc.DeleteExpired() + b.StartTimer() + for i := 100000; i <100000 + b.N; i++ { + tc.Set(strconv.Itoa(i), "bar", DefaultExpiration) + } +}