MCPcopy
hub / github.com/grafana/tempo / Store

Method Store

pkg/cache/memcached.go:155–175  ·  view source on GitHub ↗

Store stores the key in the cache.

(ctx context.Context, keys []string, bufs [][]byte)

Source from the content-addressed store, hash-verified

153
154// Store stores the key in the cache.
155func (c *Memcached) Store(ctx context.Context, keys []string, bufs [][]byte) {
156 for i := range keys {
157 select {
158 case <-ctx.Done():
159 return
160 default:
161 }
162
163 err := measureRequest(ctx, "Memcache.Put", c.requestDuration, memcacheStatusCode, func(_ context.Context) error {
164 item := memcache.Item{
165 Key: keys[i],
166 Value: bufs[i],
167 Expiration: int32(c.cfg.Expiration.Seconds()),
168 }
169 return c.memcache.Set(&item)
170 })
171 if err != nil {
172 level.Error(c.logger).Log("msg", "failed to put to memcached", "name", c.name, "err", err)
173 }
174 }
175}
176
177func (c *Memcached) Stop() {
178 c.memcache.Close()

Callers 1

Calls 5

measureRequestFunction · 0.85
DoneMethod · 0.65
SetMethod · 0.65
LogMethod · 0.65
ErrorMethod · 0.65

Tested by 1