MCPcopy Create free account
hub / github.com/patrickmn/go-cache / BenchmarkDeleteExpiredLoop

Function BenchmarkDeleteExpiredLoop

cache_test.go:1666–1678  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1664}
1665
1666func BenchmarkDeleteExpiredLoop(b *testing.B) {
1667 b.StopTimer()
1668 tc := New(5*time.Minute, 0)
1669 tc.mu.Lock()
1670 for i := 0; i < 100000; i++ {
1671 tc.set(strconv.Itoa(i), "bar", DefaultExpiration)
1672 }
1673 tc.mu.Unlock()
1674 b.StartTimer()
1675 for i := 0; i < b.N; i++ {
1676 tc.DeleteExpired()
1677 }
1678}
1679
1680func TestGetWithExpiration(t *testing.T) {
1681 tc := New(DefaultExpiration, 0)

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
setMethod · 0.80
DeleteExpiredMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…