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:
parent
6106481417
commit
5a5e4bfd2e
1 changed files with 5 additions and 4 deletions
9
app/cache/cache.go
vendored
9
app/cache/cache.go
vendored
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue