Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/storage/chunk/cache/memcached_client_test.go

39 lines
683 B

package cache_test
import (
"sync"
"github.com/bradfitz/gomemcache/memcache"
)
type mockMemcache struct {
sync.RWMutex
contents map[string][]byte
}
func newMockMemcache() *mockMemcache {
return &mockMemcache{
contents: map[string][]byte{},
}
}
func (m *mockMemcache) GetMulti(keys []string) (map[string]*memcache.Item, error) {
m.RLock()
defer m.RUnlock()
result := map[string]*memcache.Item{}
for _, k := range keys {
if c, ok := m.contents[k]; ok {
result[k] = &memcache.Item{
Value: c,
}
}
}
return result, nil
}
func (m *mockMemcache) Set(item *memcache.Item) error {
m.Lock()
defer m.Unlock()
m.contents[item.Key] = item.Value
return nil
}