in-memory lru cache of limited capacity

fix memLimit flag usage

use megabytes as a unit for memory store capacity

fix incorrect item rearrangement in lru cache

use latest 1.x Go on trais
This commit is contained in:
Serge A. Zaitsev
2018-09-23 09:29:37 +02:00
committed by Serge Zaitsev
parent 6d38ab6363
commit 1411b19ad2
6 changed files with 164 additions and 18 deletions

View File

@@ -73,9 +73,9 @@ func Git(prefix string, auth string) Option {
}
// Memory configures API to use in-memory cache for downloaded modules.
func Memory() Option {
func Memory(log logger, limit int64) Option {
return func(api *api) {
api.stores = append(api.stores, store.Memory())
api.stores = append(api.stores, store.Memory(log, limit))
}
}