(k string, x interface{}, d time.Duration)
| 86 | } |
| 87 | |
| 88 | func (c *cache) set(k string, x interface{}, d time.Duration) { |
| 89 | var e int64 |
| 90 | if d == DefaultExpiration { |
| 91 | d = c.defaultExpiration |
| 92 | } |
| 93 | if d > 0 { |
| 94 | e = time.Now().Add(d).UnixNano() |
| 95 | } |
| 96 | c.items[k] = Item{ |
| 97 | Object: x, |
| 98 | Expiration: e, |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // Add an item to the cache, replacing any existing item, using the default |
| 103 | // expiration. |