exposed configuration

This commit is contained in:
2019-11-01 16:24:22 +01:00
parent 6eaff883d4
commit 9f85a8901e
2 changed files with 17 additions and 18 deletions

View File

@ -35,7 +35,7 @@ type Handler struct {
cache *bigcache.BigCache
}
func NewHandler(binary string, eviction time.Duration) *Handler {
func NewHandler(binary string, eviction time.Duration, maxmem int) *Handler {
h := new(Handler)
h.binary = binary
h.uid = syscall.Getuid()
@ -64,7 +64,7 @@ func NewHandler(binary string, eviction time.Duration) *Handler {
}
h.logger = logrus.StandardLogger()
cacheConf := bigcache.DefaultConfig(eviction)
cacheConf.HardMaxCacheSize = 500 * 1024 * 1024 // 500MB
cacheConf.HardMaxCacheSize = maxmem
cache, e := bigcache.NewBigCache(cacheConf)
if e != nil {
h.logger.Fatal(e.Error())