(address string, sdb *sql.DB)
| 20 | } |
| 21 | |
| 22 | func New(address string, sdb *sql.DB) *Api { |
| 23 | cache, err := lru.New(256) |
| 24 | if err != nil { |
| 25 | return nil |
| 26 | } |
| 27 | |
| 28 | api := &Api{ |
| 29 | address: address, |
| 30 | cache: cache, |
| 31 | db: sdb, |
| 32 | } |
| 33 | go api.dropCacheLoop() |
| 34 | |
| 35 | return api |
| 36 | } |
| 37 | |
| 38 | func (a *Api) dropCacheLoop() { |
| 39 | // Drop the cache every 2 minutes |
no test coverage detected