Skip to content

Commit 9da5717

Browse files
committed
added example test for simple cache
1 parent 6fae63f commit 9da5717

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

policy/simple/example_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ func ExampleCache_Keys() {
4949
// baz
5050
}
5151

52+
func ExampleCache_Len() {
53+
c := simple.NewCache[string, int]()
54+
c.Set("foo", 1)
55+
c.Set("bar", 2)
56+
c.Set("baz", 3)
57+
len := c.Len()
58+
fmt.Println(len)
59+
// Output:
60+
// 3
61+
}
62+
5263
func BenchmarkLenWithKeys(b *testing.B) {
5364
c := simple.NewCache[string, int]()
5465
c.Set("foo", 1)

0 commit comments

Comments
 (0)