diff --git a/app/config.go b/app/config.go index 9ef0fe7..d49043b 100644 --- a/app/config.go +++ b/app/config.go @@ -62,6 +62,7 @@ type Configuration struct { AppName string `mapstructure:"app_name,omitempty"` BackendID string `mapstructure:"backend_id,omitempty"` BuildEnv string `mapstructure:"build_env,omitempty"` + CacheSizes map[string]CacheSize `mapstructure:"cache_sizes,omitempty"` ClusterID string `mapstructure:"cluster_id,omitempty"` Chunks map[string]Chunk `mapstructure:"chunks,omitempty"` DBMS string `mapstructure:"dbms,omitempty"` @@ -87,6 +88,16 @@ type Configuration struct { Workers map[string]Worker `mapstructure:"workers,omitempty"` } +// GetCacheSize returns the named cache size +func GetCacheSize(name string) int64 { + obj, ok := config.CacheSizes[name] + if ok { + return obj.Increment + } + sugar.Warnf("app.GetCacheSize: unknown cache size identifier: %s", name) + return 0 +} + // GetPDFRenderEngine returns a config file parameter func GetPDFRenderEngine() string { return config.PDFRenderEngine