(k string, x interface{}, d time.Duration)
| 57 | } |
| 58 | |
| 59 | func (c *cache) set(k string, x interface{}, d time.Duration) { |
| 60 | var e int64 |
| 61 | if d == DefaultExpiration { |
| 62 | d = c.defaultExpiration |
| 63 | } |
| 64 | |
| 65 | if d > 0 { |
| 66 | e = time.Now().Add(d).UnixNano() |
| 67 | } |
| 68 | c.items[k] = Item{ |
| 69 | Object: x, |
| 70 | Expiration: e, |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | func (c *cache) get(k string) (interface{}, bool) { |
| 75 | item, found := c.items[k] |