Skip to content

Commit

Permalink
Merge pull request #37 from hyp3rd/feat/backends-factory
Browse files Browse the repository at this point in the history
updated benchmarks to meet the new singatures
  • Loading branch information
hyp3rd authored Apr 3, 2023
2 parents 9a3c7b6 + 39d5692 commit b58e60a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions tests/benchmark/hypercache_get_benchmark_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tests

import (
"context"
"testing"
"time"

Expand All @@ -13,7 +14,7 @@ func BenchmarkHyperCache_Get(b *testing.B) {
cache, _ := hypercache.NewInMemoryWithDefaults(1000)

// Store a value in the cache with a key and expiration duration
cache.Set("key", "value", time.Hour)
cache.Set(context.TODO(), "key", "value", time.Hour)

b.ResetTimer()
for i := 0; i < b.N; i++ {
Expand All @@ -38,7 +39,7 @@ func BenchmarkHyperCache_Get_ProactiveEviction(b *testing.B) {
cache, _ := hypercache.New(hypercache.GetDefaultManager(), config)

// Store a value in the cache with a key and expiration duration
cache.Set("key", "value", time.Hour)
cache.Set(context.TODO(), "key", "value", time.Hour)

b.ResetTimer()
for i := 0; i < b.N; i++ {
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmark/hypercache_list_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func BenchmarkHyperCache_List(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
// Store a value in the cache with a key and expiration duration
cache.Set("key", "value", time.Hour)
cache.Set(context.TODO(), "key", "value", time.Hour)
}

list, _ := cache.List(context.TODO())
Expand Down
5 changes: 3 additions & 2 deletions tests/benchmark/hypercache_set_benchmark_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tests

import (
"context"
"fmt"
"testing"
"time"
Expand All @@ -16,7 +17,7 @@ func BenchmarkHyperCache_Set(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
// Store a value in the cache with a key and expiration duration
cache.Set(fmt.Sprintf("key-%d", i), "value", time.Hour)
cache.Set(context.TODO(), fmt.Sprintf("key-%d", i), "value", time.Hour)
}
}

Expand All @@ -38,6 +39,6 @@ func BenchmarkHyperCache_Set_Proactive_Eviction(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
// Store a value in the cache with a key and expiration duration
cache.Set(fmt.Sprintf("key-%d", i), "value", time.Hour)
cache.Set(context.TODO(), fmt.Sprintf("key-%d", i), "value", time.Hour)
}
}

0 comments on commit b58e60a

Please sign in to comment.