(ctx context.Context, keys []string, opts ...memcache.Option)
| 753 | } |
| 754 | |
| 755 | func (c *MemcachedClient) getMultiSingle(ctx context.Context, keys []string, opts ...memcache.Option) (items map[string]*memcache.Item, err error) { |
| 756 | start := time.Now() |
| 757 | c.metrics.operations.WithLabelValues(opGetMulti).Inc() |
| 758 | |
| 759 | items, err = c.client.GetMulti(ctx, keys, opts...) |
| 760 | |
| 761 | if err != nil { |
| 762 | c.trackError( |
| 763 | opGetMulti, err, |
| 764 | "msg", "failed to get multiple items from memcached", |
| 765 | ) |
| 766 | } else { |
| 767 | var total int |
| 768 | for _, it := range items { |
| 769 | total += len(it.Value) |
| 770 | } |
| 771 | c.metrics.dataSize.WithLabelValues(opGetMulti).Observe(float64(total)) |
| 772 | c.metrics.duration.WithLabelValues(opGetMulti).Observe(time.Since(start).Seconds()) |
| 773 | } |
| 774 | |
| 775 | return items, err |
| 776 | } |
| 777 | |
| 778 | // doWithBatch do func with batch and gate. batchSize==0 means one batch. gate==nil means no gate. |
| 779 | func doWithBatch(ctx context.Context, totalSize int, batchSize int, ga gate.Gate, f func(startIndex, endIndex int) error) error { |
no test coverage detected