(k string, x interface{}, d time.Duration)
| 68 | } |
| 69 | |
| 70 | func (c *cache) set(k string, x interface{}, d time.Duration) { |
| 71 | var e int64 |
| 72 | if d == DefaultExpiration { |
| 73 | d = c.defaultExpiration |
| 74 | } |
| 75 | if d > 0 { |
| 76 | e = time.Now().Add(d).UnixNano() |
| 77 | } |
| 78 | c.items[k] = Item{ |
| 79 | Object: x, |
| 80 | Expiration: e, |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | // Add an item to the cache, replacing any existing item, using the default |
| 85 | // expiration. |