(key string, value interface{}, ttl time.Duration)
| 25 | } |
| 26 | |
| 27 | func (c *Cache) Set(key string, value interface{}, ttl time.Duration) error { |
| 28 | ctx, cancel := context.WithTimeout(context.Background(), c.wt) |
| 29 | defer cancel() |
| 30 | err := c.client.Set(ctx, key, value, ttl).Err() |
| 31 | if err != nil { |
| 32 | return err |
| 33 | } |
| 34 | |
| 35 | return nil |
| 36 | } |
| 37 | |
| 38 | func (c *Cache) Delete(key string) error { |
| 39 | ctx, cancel := context.WithTimeout(context.Background(), c.wt) |