improvements to caching for lists and relationship to accounts / follows

This commit is contained in:
kim 2024-09-11 22:38:35 +01:00
commit 002bd86a39
27 changed files with 1002 additions and 1333 deletions

View file

@ -62,7 +62,6 @@ func (c *Caches) Init() {
log.Infof(nil, "init: %p", c)
c.initAccount()
c.initAccountIDsFollowingTag()
c.initAccountNote()
c.initAccountSettings()
c.initAccountStats()
@ -84,11 +83,13 @@ func (c *Caches) Init() {
c.initFollowIDs()
c.initFollowRequest()
c.initFollowRequestIDs()
c.initFollowingTagIDs()
c.initInReplyToIDs()
c.initInstance()
c.initInteractionRequest()
c.initList()
c.initListEntry()
c.initListIDs()
c.initListedIDs()
c.initMarker()
c.initMedia()
c.initMention()
@ -105,7 +106,6 @@ func (c *Caches) Init() {
c.initStatusFave()
c.initStatusFaveIDs()
c.initTag()
c.initTagIDsFollowedByAccount()
c.initThreadMute()
c.initToken()
c.initTombstone()
@ -148,7 +148,6 @@ func (c *Caches) Stop() {
// significant overhead to all cache writes.
func (c *Caches) Sweep(threshold float64) {
c.DB.Account.Trim(threshold)
c.DB.AccountIDsFollowingTag.Trim(threshold)
c.DB.AccountNote.Trim(threshold)
c.DB.AccountSettings.Trim(threshold)
c.DB.AccountStats.Trim(threshold)
@ -168,11 +167,13 @@ func (c *Caches) Sweep(threshold float64) {
c.DB.FollowIDs.Trim(threshold)
c.DB.FollowRequest.Trim(threshold)
c.DB.FollowRequestIDs.Trim(threshold)
c.DB.FollowingTagIDs.Trim(threshold)
c.DB.InReplyToIDs.Trim(threshold)
c.DB.Instance.Trim(threshold)
c.DB.InteractionRequest.Trim(threshold)
c.DB.List.Trim(threshold)
c.DB.ListEntry.Trim(threshold)
c.DB.ListIDs.Trim(threshold)
c.DB.ListedIDs.Trim(threshold)
c.DB.Marker.Trim(threshold)
c.DB.Media.Trim(threshold)
c.DB.Mention.Trim(threshold)
@ -189,7 +190,6 @@ func (c *Caches) Sweep(threshold float64) {
c.DB.StatusFave.Trim(threshold)
c.DB.StatusFaveIDs.Trim(threshold)
c.DB.Tag.Trim(threshold)
c.DB.TagIDsFollowedByAccount.Trim(threshold)
c.DB.ThreadMute.Trim(threshold)
c.DB.Token.Trim(threshold)
c.DB.Tombstone.Trim(threshold)