(c *cache)
| 229 | } |
| 230 | |
| 231 | func (j *janitor) Run(c *cache) { |
| 232 | j.stop = make(chan bool) |
| 233 | ticker := time.NewTicker(j.Interval) |
| 234 | for { |
| 235 | select { |
| 236 | case <-ticker.C: |
| 237 | //delete expired |
| 238 | c.DeleteExpired() |
| 239 | case <-j.stop: |
| 240 | ticker.Stop() |
| 241 | return |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | func stopJanitor(c *Cache) { |
| 247 | c.janitor.stop <- true |
no test coverage detected