cmd/ctrld: add default value and CLI flag for cache size

This commit is contained in:
Cuong Manh Le
2022-12-22 10:20:44 +07:00
committed by Cuong Manh Le
parent b93970ccfd
commit e6d77e2586
2 changed files with 22 additions and 2 deletions
+10
View File
@@ -20,6 +20,7 @@ var (
secondaryUpstream string
domains []string
logPath string
cacheSize int
cfg ctrld.Config
verbose int
@@ -75,3 +76,12 @@ func initLogging() {
}
zerolog.SetGlobalLevel(level)
}
func initCache() {
if !cfg.Service.CacheEnable {
return
}
if cfg.Service.CacheSize == 0 {
cfg.Service.CacheSize = 4096
}
}