Skip to content

Commit

Permalink
refactor: add bench test
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Aug 13, 2023
1 parent 7c7ec73 commit fbb996a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions middleware/lru_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,12 @@ func TestLruStore(t *testing.T) {
buf, _ = store.Get(ctx, key1)
assert.Empty(buf)
}

func BenchmarkLruStore(b *testing.B) {
store := NewLruStore(128)
ctx := context.Background()
for i := 0; i < b.N; i++ {
_ = store.Set(ctx, "key", []byte("Hello world!"), time.Second)
_, _ = store.Get(ctx, "key")
}
}

0 comments on commit fbb996a

Please sign in to comment.