fix cache

v0.0.7 v0.0.7
Vernon Keenan 2021-01-10 14:27:09 -08:00
parent 4579ca4e2f
commit c27f9e18f6
1 changed files with 11 additions and 0 deletions

View File

@ -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