MCPcopy
hub / github.com/grafana/dskit / Add

Method Add

cache/mock.go:55–65  ·  view source on GitHub ↗
(_ context.Context, key string, value []byte, ttl time.Duration)

Source from the content-addressed store, hash-verified

53}
54
55func (m *MockCache) Add(_ context.Context, key string, value []byte, ttl time.Duration) error {
56 m.mu.Lock()
57 defer m.mu.Unlock()
58
59 if i, ok := m.cache[key]; ok && i.ExpiresAt.After(m.now) {
60 return ErrNotStored
61 }
62
63 m.cache[key] = Item{Data: value, ExpiresAt: m.now.Add(ttl)}
64 return nil
65}
66
67func (m *MockCache) GetMulti(ctx context.Context, keys []string, opts ...Option) map[string][]byte {
68 result, _ := m.GetMultiWithError(ctx, keys, opts...)

Callers

nothing calls this directly

Calls 2

AfterMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected