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 9c6b76a commit f08595aCopy full SHA for f08595a
policy/simple/example_test.go
@@ -2,6 +2,7 @@ package simple_test
2
3
import (
4
"fmt"
5
+ "testing"
6
7
"github.com/Code-Hex/go-generics-cache/policy/simple"
8
)
@@ -47,3 +48,23 @@ func ExampleCache_Keys() {
47
48
// bar
49
// baz
50
}
51
+
52
+func BenchmarkLenWithKeys(b *testing.B) {
53
+ c := simple.NewCache[string, int]()
54
+ c.Set("foo", 1)
55
+ c.Set("bar", 2)
56
+ c.Set("baz", 3)
57
+ for i := 0; i < b.N; i++ {
58
+ var _ = len(c.Keys())
59
+ }
60
+}
61
62
+func BenchmarkJustLen(b *testing.B) {
63
64
65
66
67
68
+ var _ = c.Len()
69
70
0 commit comments