From 39d56927a2bc5ca247dba85b6d6973f69b918ae0 Mon Sep 17 00:00:00 2001 From: Francesco Cosentino Date: Mon, 3 Apr 2023 18:53:28 +0200 Subject: [PATCH] updated benchmarks to meet the new singatures --- tests/benchmark/hypercache_get_benchmark_test.go | 5 +++-- tests/benchmark/hypercache_list_benchmark_test.go | 2 +- tests/benchmark/hypercache_set_benchmark_test.go | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/benchmark/hypercache_get_benchmark_test.go b/tests/benchmark/hypercache_get_benchmark_test.go index 273fbd4..6357658 100644 --- a/tests/benchmark/hypercache_get_benchmark_test.go +++ b/tests/benchmark/hypercache_get_benchmark_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "testing" "time" @@ -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++ { @@ -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++ { diff --git a/tests/benchmark/hypercache_list_benchmark_test.go b/tests/benchmark/hypercache_list_benchmark_test.go index 0453bef..d008dbf 100644 --- a/tests/benchmark/hypercache_list_benchmark_test.go +++ b/tests/benchmark/hypercache_list_benchmark_test.go @@ -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()) diff --git a/tests/benchmark/hypercache_set_benchmark_test.go b/tests/benchmark/hypercache_set_benchmark_test.go index 718823c..40153f1 100644 --- a/tests/benchmark/hypercache_set_benchmark_test.go +++ b/tests/benchmark/hypercache_set_benchmark_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "fmt" "testing" "time" @@ -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) } } @@ -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) } }