()
| 36 | } |
| 37 | |
| 38 | func (a *Api) dropCacheLoop() { |
| 39 | // Drop the cache every 2 minutes |
| 40 | ticker := time.NewTicker(2 * time.Minute) |
| 41 | for range ticker.C { |
| 42 | log.Info("Dropping Cache") |
| 43 | c, err := lru.New(256) |
| 44 | if err != nil { |
| 45 | panic(err) |
| 46 | } |
| 47 | a.cache = c |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | func (a *Api) HandleRequests() { |
| 52 | router := mux.NewRouter().StrictSlash(true) |