diff options
author | 2024-04-15 14:22:21 +0100 | |
---|---|---|
committer | 2024-04-15 14:22:21 +0100 | |
commit | f79d50b9b26590b6d2468aeb41f0846272e08d1a (patch) | |
tree | 196b9bfaf8ad6fce782c2130633cfb5c97cbd31a /internal/config/helpers.gen.go | |
parent | [chore] Turn `accounts-registration-open` false by default (#2839) (diff) | |
download | gotosocial-f79d50b9b26590b6d2468aeb41f0846272e08d1a.tar.xz |
[performance] cached oauth database types (#2838)
* update token + client code to use struct caches
* add code comments
* slight tweak to default mem ratios
* fix envparsing
* add appropriate invalidate hooks
* update the tokenstore sweeping function to rely on caches
* update to use PutClient()
* add ClientID to list of token struct indices
Diffstat (limited to 'internal/config/helpers.gen.go')
-rw-r--r-- | internal/config/helpers.gen.go | 50 |
1 files changed, 50 insertions, 0 deletions
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() |