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

Method Set

cache/lru.go:110–123  ·  cache/lru.go::LRUCache.Set
(ctx context.Context, key string, value []byte, ttl time.Duration)

Source from the content-addressed store, hash-verified

108}
109
110func (l *LRUCache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error {
111 err := l.c.Set(ctx, key, value, ttl)
112
113 l.mtx.Lock()
114 defer l.mtx.Unlock()
115
116 expires := time.Now().Add(ttl)
117 l.lru.Add(key, &Item{
118 Data: value,
119 ExpiresAt: expires,
120 })
121
122 return err
123}
124
125func (l *LRUCache) Add(ctx context.Context, key string, value []byte, ttl time.Duration) error {
126 err := l.c.Add(ctx, key, value, ttl)

Callers

nothing calls this directly

Calls 2

SetMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected