(ctx context.Context)
| 576 | } |
| 577 | |
| 578 | func (c *MemcachedClient) FlushAll(ctx context.Context) error { |
| 579 | var err error |
| 580 | start := time.Now() |
| 581 | c.metrics.operations.WithLabelValues(opFlush).Inc() |
| 582 | |
| 583 | select { |
| 584 | case <-ctx.Done(): |
| 585 | err = ctx.Err() |
| 586 | default: |
| 587 | err = c.client.FlushAll() |
| 588 | } |
| 589 | if err != nil { |
| 590 | c.trackError( |
| 591 | opFlush, err, |
| 592 | "msg", "failed to flush all cache", |
| 593 | ) |
| 594 | } else { |
| 595 | c.metrics.duration.WithLabelValues(opFlush).Observe(time.Since(start).Seconds()) |
| 596 | } |
| 597 | |
| 598 | return err |
| 599 | } |
| 600 | |
| 601 | func (c *MemcachedClient) storeOperation(ctx context.Context, key string, value []byte, ttl time.Duration, operation string, f func(ctx context.Context, key string, value []byte, ttl time.Duration) error) error { |
| 602 | if !c.itemSizeIsAcceptable(key, value, operation) { |
nothing calls this directly
no test coverage detected