summaryrefslogtreecommitdiff
path: root/internal/cache/cache.go
diff options
context:
space:
mode:
authorLibravatar Vyr Cossont <VyrCossont@users.noreply.github.com>2024-07-29 11:26:31 -0700
committerLibravatar GitHub <noreply@github.com>2024-07-29 19:26:31 +0100
commita237e2b295fee71bdf7266520b0b6e0fb79b565c (patch)
treec522adc47019584b60de9420595505820635bb11 /internal/cache/cache.go
parent[bugfix] take into account rotation when generating thumbnail (#3147) (diff)
downloadgotosocial-a237e2b295fee71bdf7266520b0b6e0fb79b565c.tar.xz
[feature] Implement following hashtags (#3141)
* Implement followed tags API * Insert statuses with followed tags into home timelines * Test following and unfollowing tags * Correct Swagger path params * Trim conversation caches * Migration for followed_tags table * Followed tag caches and DB implementation * Lint and tests * Add missing tag info endpoint, reorganize tag API * Unwrap boosts when timelining based on tags * Apply visibility filters to tag followers * Address review comments
Diffstat (limited to 'internal/cache/cache.go')
-rw-r--r--internal/cache/cache.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/cache/cache.go b/internal/cache/cache.go
index 8187ba419..2949d528a 100644
--- a/internal/cache/cache.go
+++ b/internal/cache/cache.go
@@ -57,6 +57,7 @@ func (c *Caches) Init() {
log.Infof(nil, "init: %p", c)
c.initAccount()
+ c.initAccountIDsFollowingTag()
c.initAccountNote()
c.initAccountSettings()
c.initAccountStats()
@@ -98,6 +99,7 @@ func (c *Caches) Init() {
c.initStatusFave()
c.initStatusFaveIDs()
c.initTag()
+ c.initTagIDsFollowedByAccount()
c.initThreadMute()
c.initToken()
c.initTombstone()
@@ -134,6 +136,7 @@ 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)
@@ -142,6 +145,8 @@ func (c *Caches) Sweep(threshold float64) {
c.DB.BlockIDs.Trim(threshold)
c.DB.BoostOfIDs.Trim(threshold)
c.DB.Client.Trim(threshold)
+ c.DB.Conversation.Trim(threshold)
+ c.DB.ConversationLastStatusIDs.Trim(threshold)
c.DB.Emoji.Trim(threshold)
c.DB.EmojiCategory.Trim(threshold)
c.DB.Filter.Trim(threshold)
@@ -171,6 +176,7 @@ 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)