Skip to content

Commit

Permalink
added example test for simple cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Code-Hex committed Apr 14, 2024
1 parent 6fae63f commit 9da5717
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions policy/simple/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ func ExampleCache_Keys() {
// baz
}

func ExampleCache_Len() {
c := simple.NewCache[string, int]()
c.Set("foo", 1)
c.Set("bar", 2)
c.Set("baz", 3)
len := c.Len()
fmt.Println(len)
// Output:
// 3
}

func BenchmarkLenWithKeys(b *testing.B) {
c := simple.NewCache[string, int]()
c.Set("foo", 1)
Expand Down

0 comments on commit 9da5717

Please sign in to comment.