We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cf4e165 commit 28ab885Copy full SHA for 28ab885
cache_test.go
@@ -1604,16 +1604,14 @@ func BenchmarkIncrementInt(b *testing.B) {
1604
1605
func BenchmarkDeleteExpired(b *testing.B) {
1606
b.StopTimer()
1607
- tc := New(1, 0)
+ tc := New(5 * time.Minute, 0)
1608
tc.mu.Lock()
1609
- for i := 0; i < b.N; i++ {
+ for i := 0; i < 100000; i++ {
1610
tc.set(strconv.Itoa(i), "bar", DefaultExpiration)
1611
}
1612
tc.mu.Unlock()
1613
- time.Sleep(100)
1614
- if _, found := tc.Get("0"); found {
1615
- b.Fatal("0 found")
1616
- }
1617
b.StartTimer()
1618
- tc.DeleteExpired()
+ for i := 0; i < b.N; i++ {
+ tc.DeleteExpired()
+ }
1619
0 commit comments