(_ context.Context, key string, value []byte, ttl time.Duration)
| 53 | } |
| 54 | |
| 55 | func (m *MockCache) Add(_ context.Context, key string, value []byte, ttl time.Duration) error { |
| 56 | m.mu.Lock() |
| 57 | defer m.mu.Unlock() |
| 58 | |
| 59 | if i, ok := m.cache[key]; ok && i.ExpiresAt.After(m.now) { |
| 60 | return ErrNotStored |
| 61 | } |
| 62 | |
| 63 | m.cache[key] = Item{Data: value, ExpiresAt: m.now.Add(ttl)} |
| 64 | return nil |
| 65 | } |
| 66 | |
| 67 | func (m *MockCache) GetMulti(ctx context.Context, keys []string, opts ...Option) map[string][]byte { |
| 68 | result, _ := m.GetMultiWithError(ctx, keys, opts...) |