diff options
author | 2023-08-04 12:28:33 +0100 | |
---|---|---|
committer | 2023-08-04 12:28:33 +0100 | |
commit | 9a291dea843448f78b4b98ea6813739aebe708c6 (patch) | |
tree | f1ce643a3c9fe1b13e4c107f15b1ac4b20fe5b86 /internal/config | |
parent | [feature] simpler cache size configuration (#2051) (diff) | |
download | gotosocial-9a291dea843448f78b4b98ea6813739aebe708c6.tar.xz |
[performance] add caching of status fave, boost of, in reply to ID lists (#2060)
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 3 | ||||
-rw-r--r-- | internal/config/defaults.go | 3 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 75 |
3 files changed, 81 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 50508e40b..ef79d4e12 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -180,12 +180,14 @@ type CacheConfiguration struct { AccountNoteMemRatio float64 `name:"account-note-mem-ratio"` BlockMemRatio float64 `name:"block-mem-ratio"` BlockIDsMemRatio float64 `name:"block-mem-ratio"` + BoostOfIDsMemRatio float64 `name:"boost-of-ids-mem-ratio"` EmojiMemRatio float64 `name:"emoji-mem-ratio"` EmojiCategoryMemRatio float64 `name:"emoji-category-mem-ratio"` FollowMemRatio float64 `name:"follow-mem-ratio"` FollowIDsMemRatio float64 `name:"follow-ids-mem-ratio"` FollowRequestMemRatio float64 `name:"follow-request-mem-ratio"` FollowRequestIDsMemRatio float64 `name:"follow-request-ids-mem-ratio"` + InReplyToIDsMemRatio float64 `name:"in-reply-to-ids-mem-ratio"` InstanceMemRatio float64 `name:"instance-mem-ratio"` ListMemRatio float64 `name:"list-mem-ratio"` ListEntryMemRatio float64 `name:"list-entry-mem-ratio"` @@ -196,6 +198,7 @@ type CacheConfiguration struct { ReportMemRatio float64 `name:"report-mem-ratio"` StatusMemRatio float64 `name:"status-mem-ratio"` StatusFaveMemRatio float64 `name:"status-fave-mem-ratio"` + StatusFaveIDsMemRatio float64 `name:"status-fave-ids-mem-ratio"` TagMemRatio float64 `name:"tag-mem-ratio"` TombstoneMemRatio float64 `name:"tombstone-mem-ratio"` UserMemRatio float64 `name:"user-mem-ratio"` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index e740d1c98..2bc95f6f1 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -149,12 +149,14 @@ var Defaults = Configuration{ AccountNoteMemRatio: 0.1, BlockMemRatio: 3, BlockIDsMemRatio: 3, + BoostOfIDsMemRatio: 3, EmojiMemRatio: 3, EmojiCategoryMemRatio: 0.1, FollowMemRatio: 4, FollowIDsMemRatio: 4, FollowRequestMemRatio: 2, FollowRequestIDsMemRatio: 2, + InReplyToIDsMemRatio: 3, InstanceMemRatio: 1, ListMemRatio: 3, ListEntryMemRatio: 3, @@ -165,6 +167,7 @@ var Defaults = Configuration{ ReportMemRatio: 1, StatusMemRatio: 18, StatusFaveMemRatio: 5, + StatusFaveIDsMemRatio: 3, TagMemRatio: 3, TombstoneMemRatio: 2, UserMemRatio: 0.1, diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index c29b5c38f..0a299e7d0 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -2549,6 +2549,31 @@ func GetCacheBlockIDsMemRatio() float64 { return global.GetCacheBlockIDsMemRatio // SetCacheBlockIDsMemRatio safely sets the value for global configuration 'Cache.BlockIDsMemRatio' field func SetCacheBlockIDsMemRatio(v float64) { global.SetCacheBlockIDsMemRatio(v) } +// GetCacheBoostOfIDsMemRatio safely fetches the Configuration value for state's 'Cache.BoostOfIDsMemRatio' field +func (st *ConfigState) GetCacheBoostOfIDsMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.BoostOfIDsMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheBoostOfIDsMemRatio safely sets the Configuration value for state's 'Cache.BoostOfIDsMemRatio' field +func (st *ConfigState) SetCacheBoostOfIDsMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.BoostOfIDsMemRatio = v + st.reloadToViper() +} + +// CacheBoostOfIDsMemRatioFlag returns the flag name for the 'Cache.BoostOfIDsMemRatio' field +func CacheBoostOfIDsMemRatioFlag() string { return "cache-boost-of-ids-mem-ratio" } + +// GetCacheBoostOfIDsMemRatio safely fetches the value for global configuration 'Cache.BoostOfIDsMemRatio' field +func GetCacheBoostOfIDsMemRatio() float64 { return global.GetCacheBoostOfIDsMemRatio() } + +// SetCacheBoostOfIDsMemRatio safely sets the value for global configuration 'Cache.BoostOfIDsMemRatio' field +func SetCacheBoostOfIDsMemRatio(v float64) { global.SetCacheBoostOfIDsMemRatio(v) } + // GetCacheEmojiMemRatio safely fetches the Configuration value for state's 'Cache.EmojiMemRatio' field func (st *ConfigState) GetCacheEmojiMemRatio() (v float64) { st.mutex.RLock() @@ -2699,6 +2724,31 @@ func GetCacheFollowRequestIDsMemRatio() float64 { return global.GetCacheFollowRe // SetCacheFollowRequestIDsMemRatio safely sets the value for global configuration 'Cache.FollowRequestIDsMemRatio' field func SetCacheFollowRequestIDsMemRatio(v float64) { global.SetCacheFollowRequestIDsMemRatio(v) } +// GetCacheInReplyToIDsMemRatio safely fetches the Configuration value for state's 'Cache.InReplyToIDsMemRatio' field +func (st *ConfigState) GetCacheInReplyToIDsMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.InReplyToIDsMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheInReplyToIDsMemRatio safely sets the Configuration value for state's 'Cache.InReplyToIDsMemRatio' field +func (st *ConfigState) SetCacheInReplyToIDsMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.InReplyToIDsMemRatio = v + st.reloadToViper() +} + +// CacheInReplyToIDsMemRatioFlag returns the flag name for the 'Cache.InReplyToIDsMemRatio' field +func CacheInReplyToIDsMemRatioFlag() string { return "cache-in-reply-to-ids-mem-ratio" } + +// GetCacheInReplyToIDsMemRatio safely fetches the value for global configuration 'Cache.InReplyToIDsMemRatio' field +func GetCacheInReplyToIDsMemRatio() float64 { return global.GetCacheInReplyToIDsMemRatio() } + +// SetCacheInReplyToIDsMemRatio safely sets the value for global configuration 'Cache.InReplyToIDsMemRatio' field +func SetCacheInReplyToIDsMemRatio(v float64) { global.SetCacheInReplyToIDsMemRatio(v) } + // GetCacheInstanceMemRatio safely fetches the Configuration value for state's 'Cache.InstanceMemRatio' field func (st *ConfigState) GetCacheInstanceMemRatio() (v float64) { st.mutex.RLock() @@ -2949,6 +2999,31 @@ func GetCacheStatusFaveMemRatio() float64 { return global.GetCacheStatusFaveMemR // SetCacheStatusFaveMemRatio safely sets the value for global configuration 'Cache.StatusFaveMemRatio' field func SetCacheStatusFaveMemRatio(v float64) { global.SetCacheStatusFaveMemRatio(v) } +// GetCacheStatusFaveIDsMemRatio safely fetches the Configuration value for state's 'Cache.StatusFaveIDsMemRatio' field +func (st *ConfigState) GetCacheStatusFaveIDsMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.StatusFaveIDsMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheStatusFaveIDsMemRatio safely sets the Configuration value for state's 'Cache.StatusFaveIDsMemRatio' field +func (st *ConfigState) SetCacheStatusFaveIDsMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.StatusFaveIDsMemRatio = v + st.reloadToViper() +} + +// CacheStatusFaveIDsMemRatioFlag returns the flag name for the 'Cache.StatusFaveIDsMemRatio' field +func CacheStatusFaveIDsMemRatioFlag() string { return "cache-status-fave-ids-mem-ratio" } + +// GetCacheStatusFaveIDsMemRatio safely fetches the value for global configuration 'Cache.StatusFaveIDsMemRatio' field +func GetCacheStatusFaveIDsMemRatio() float64 { return global.GetCacheStatusFaveIDsMemRatio() } + +// SetCacheStatusFaveIDsMemRatio safely sets the value for global configuration 'Cache.StatusFaveIDsMemRatio' field +func SetCacheStatusFaveIDsMemRatio(v float64) { global.SetCacheStatusFaveIDsMemRatio(v) } + // GetCacheTagMemRatio safely fetches the Configuration value for state's 'Cache.TagMemRatio' field func (st *ConfigState) GetCacheTagMemRatio() (v float64) { st.mutex.RLock() |