1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-17 04:30:03 +02:00

app/cache/cache.go: make context aware and pass context down to store.

This commit is contained in:
Henrik Hautakoski 2023-12-17 17:57:49 +01:00
parent 6106481417
commit 5a5e4bfd2e

9
app/cache/cache.go vendored
View file

@ -1,6 +1,7 @@
package cache
import (
"context"
"time"
)
@ -17,12 +18,12 @@ func NewCache(prefix string, store Store) *Cache {
}
}
func (cache *Cache) Get(key string, value any) error {
return cache.store.Get(cache.key(key), value)
func (cache *Cache) Get(ctx context.Context, key string, value any) error {
return cache.store.Get(ctx, cache.key(key), value)
}
func (cache *Cache) Set(key string, value any, ttl time.Duration) error {
return cache.store.Set(cache.key(key), value, ttl)
func (cache *Cache) Set(ctx context.Context, key string, value any, ttl time.Duration) error {
return cache.store.Set(ctx, cache.key(key), value, ttl)
}
func (cache *Cache) key(key string) string {