diff options
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 2 | ||||
-rw-r--r-- | internal/config/defaults.go | 2 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 50 |
3 files changed, 54 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index dee9e99de..3cd67525f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -199,6 +199,7 @@ type CacheConfiguration struct { BlockMemRatio float64 `name:"block-mem-ratio"` BlockIDsMemRatio float64 `name:"block-mem-ratio"` BoostOfIDsMemRatio float64 `name:"boost-of-ids-mem-ratio"` + ClientMemRatio float64 `name:"client-mem-ratio"` EmojiMemRatio float64 `name:"emoji-mem-ratio"` EmojiCategoryMemRatio float64 `name:"emoji-category-mem-ratio"` FilterMemRatio float64 `name:"filter-mem-ratio"` @@ -226,6 +227,7 @@ type CacheConfiguration struct { StatusFaveIDsMemRatio float64 `name:"status-fave-ids-mem-ratio"` TagMemRatio float64 `name:"tag-mem-ratio"` ThreadMuteMemRatio float64 `name:"thread-mute-mem-ratio"` + TokenMemRatio float64 `name:"token-mem-ratio"` TombstoneMemRatio float64 `name:"tombstone-mem-ratio"` UserMemRatio float64 `name:"user-mem-ratio"` WebfingerMemRatio float64 `name:"webfinger-mem-ratio"` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index 64fff366a..f5f8fb6ac 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -163,6 +163,7 @@ var Defaults = Configuration{ BlockMemRatio: 2, BlockIDsMemRatio: 3, BoostOfIDsMemRatio: 3, + ClientMemRatio: 0.1, EmojiMemRatio: 3, EmojiCategoryMemRatio: 0.1, FilterMemRatio: 0.5, @@ -190,6 +191,7 @@ var Defaults = Configuration{ StatusFaveIDsMemRatio: 3, TagMemRatio: 2, ThreadMuteMemRatio: 0.2, + TokenMemRatio: 0.75, TombstoneMemRatio: 0.5, UserMemRatio: 0.25, WebfingerMemRatio: 0.1, diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 39d26d13e..a8c919834 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -2925,6 +2925,31 @@ func GetCacheBoostOfIDsMemRatio() float64 { return global.GetCacheBoostOfIDsMemR // SetCacheBoostOfIDsMemRatio safely sets the value for global configuration 'Cache.BoostOfIDsMemRatio' field func SetCacheBoostOfIDsMemRatio(v float64) { global.SetCacheBoostOfIDsMemRatio(v) } +// GetCacheClientMemRatio safely fetches the Configuration value for state's 'Cache.ClientMemRatio' field +func (st *ConfigState) GetCacheClientMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.ClientMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheClientMemRatio safely sets the Configuration value for state's 'Cache.ClientMemRatio' field +func (st *ConfigState) SetCacheClientMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.ClientMemRatio = v + st.reloadToViper() +} + +// CacheClientMemRatioFlag returns the flag name for the 'Cache.ClientMemRatio' field +func CacheClientMemRatioFlag() string { return "cache-client-mem-ratio" } + +// GetCacheClientMemRatio safely fetches the value for global configuration 'Cache.ClientMemRatio' field +func GetCacheClientMemRatio() float64 { return global.GetCacheClientMemRatio() } + +// SetCacheClientMemRatio safely sets the value for global configuration 'Cache.ClientMemRatio' field +func SetCacheClientMemRatio(v float64) { global.SetCacheClientMemRatio(v) } + // GetCacheEmojiMemRatio safely fetches the Configuration value for state's 'Cache.EmojiMemRatio' field func (st *ConfigState) GetCacheEmojiMemRatio() (v float64) { st.mutex.RLock() @@ -3600,6 +3625,31 @@ func GetCacheThreadMuteMemRatio() float64 { return global.GetCacheThreadMuteMemR // SetCacheThreadMuteMemRatio safely sets the value for global configuration 'Cache.ThreadMuteMemRatio' field func SetCacheThreadMuteMemRatio(v float64) { global.SetCacheThreadMuteMemRatio(v) } +// GetCacheTokenMemRatio safely fetches the Configuration value for state's 'Cache.TokenMemRatio' field +func (st *ConfigState) GetCacheTokenMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.TokenMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheTokenMemRatio safely sets the Configuration value for state's 'Cache.TokenMemRatio' field +func (st *ConfigState) SetCacheTokenMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.TokenMemRatio = v + st.reloadToViper() +} + +// CacheTokenMemRatioFlag returns the flag name for the 'Cache.TokenMemRatio' field +func CacheTokenMemRatioFlag() string { return "cache-token-mem-ratio" } + +// GetCacheTokenMemRatio safely fetches the value for global configuration 'Cache.TokenMemRatio' field +func GetCacheTokenMemRatio() float64 { return global.GetCacheTokenMemRatio() } + +// SetCacheTokenMemRatio safely sets the value for global configuration 'Cache.TokenMemRatio' field +func SetCacheTokenMemRatio(v float64) { global.SetCacheTokenMemRatio(v) } + // GetCacheTombstoneMemRatio safely fetches the Configuration value for state's 'Cache.TombstoneMemRatio' field func (st *ConfigState) GetCacheTombstoneMemRatio() (v float64) { st.mutex.RLock() |