MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / BenchmarkDeleteExpiredLoop

Function BenchmarkDeleteExpiredLoop

pkg/util/cache/cache_test.go:1682–1694  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1680}
1681
1682func BenchmarkDeleteExpiredLoop(b *testing.B) {
1683 b.StopTimer()
1684 tc := New(5*time.Minute, 0)
1685 tc.mu.Lock()
1686 for i := 0; i < 100000; i++ {
1687 tc.set(strconv.Itoa(i), "bar", DefaultExpiration)
1688 }
1689 tc.mu.Unlock()
1690 b.StartTimer()
1691 for i := 0; i < b.N; i++ {
1692 tc.DeleteExpired()
1693 }
1694}
1695
1696func TestGetWithExpiration(t *testing.T) {
1697 tc := New(DefaultExpiration, 0)

Callers

nothing calls this directly

Calls 4

LockMethod · 0.80
DeleteExpiredMethod · 0.80
NewFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected