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

Method itemSizeIsAcceptable

cache/memcached_client.go:342–351  ·  view source on GitHub ↗
(key string, value []byte, op string)

Source from the content-addressed store, hash-verified

340}
341
342func (c *MemcachedClient) itemSizeIsAcceptable(key string, value []byte, op string) bool {
343 if c.config.MaxItemSize > 0 && len(value) > c.config.MaxItemSize {
344 c.metrics.skipped.WithLabelValues(op, reasonMaxItemSize).Inc()
345 c.metrics.skippedDataSize.WithLabelValues(op).Observe(float64(len(value)))
346 level.Debug(c.logger).Log("msg", "failed to store item to cache because it is too large", "key", key, "size", len(value), "max_item_size", c.config.MaxItemSize, "op", op)
347 return false
348 }
349
350 return true
351}
352
353func (c *MemcachedClient) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error {
354 return c.storeOperation(ctx, key, value, ttl, opSet, func(ctx context.Context, key string, value []byte, ttl time.Duration) error {

Callers

nothing calls this directly

Calls 1

LogMethod · 0.45

Tested by

no test coverage detected