(key string, value *types.File, expireSeconds int)
| 48 | } |
| 49 | |
| 50 | func (c *Cache) Set(key string, value *types.File, expireSeconds int) error { |
| 51 | c.mu.Lock() |
| 52 | defer c.mu.Unlock() |
| 53 | var buf bytes.Buffer |
| 54 | enc := gob.NewEncoder(&buf) |
| 55 | err := enc.Encode(value) |
| 56 | if err != nil { |
| 57 | return err |
| 58 | } |
| 59 | cache.cache.Set([]byte(key), buf.Bytes(), expireSeconds) |
| 60 | return nil |
| 61 | } |
| 62 | |
| 63 | func (c *Cache) Delete(key string) error { |
| 64 | c.mu.Lock() |
no outgoing calls
no test coverage detected