(k string, x interface{}, d time.Duration)
| 39 | } |
| 40 | |
| 41 | func (c *cache) Set(k string, x interface{}, d time.Duration) { |
| 42 | var e int64 |
| 43 | if d == DefaultExpiration { |
| 44 | d = c.defaultExpiration |
| 45 | } |
| 46 | |
| 47 | if d > 0 { |
| 48 | e = time.Now().Add(d).UnixNano() |
| 49 | } |
| 50 | c.mu.Lock() |
| 51 | c.items[k] = Item{ |
| 52 | Object: x, |
| 53 | Expiration: e, |
| 54 | } |
| 55 | c.mu.Unlock() |
| 56 | |
| 57 | } |
| 58 | |
| 59 | func (c *cache) set(k string, x interface{}, d time.Duration) { |
| 60 | var e int64 |
no test coverage detected