summaryrefslogtreecommitdiff
path: root/internal/cache/cache.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-08-04 12:28:33 +0100
committerLibravatar GitHub <noreply@github.com>2023-08-04 12:28:33 +0100
commit9a291dea843448f78b4b98ea6813739aebe708c6 (patch)
treef1ce643a3c9fe1b13e4c107f15b1ac4b20fe5b86 /internal/cache/cache.go
parent[feature] simpler cache size configuration (#2051) (diff)
downloadgotosocial-9a291dea843448f78b4b98ea6813739aebe708c6.tar.xz
[performance] add caching of status fave, boost of, in reply to ID lists (#2060)
Diffstat (limited to 'internal/cache/cache.go')
-rw-r--r--internal/cache/cache.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/cache/cache.go b/internal/cache/cache.go
index cb5503a84..ec0ec3faa 100644
--- a/internal/cache/cache.go
+++ b/internal/cache/cache.go
@@ -196,6 +196,21 @@ func (c *Caches) setuphooks() {
// c.GTS.Media().Invalidate("StatusID") will not work.
c.GTS.Media().Invalidate("ID", id)
}
+
+ if status.BoostOfID != "" {
+ // Invalidate boost ID list of the original status.
+ c.GTS.BoostOfIDs().Invalidate(status.BoostOfID)
+ }
+
+ if status.InReplyToID != "" {
+ // Invalidate in reply to ID list of original status.
+ c.GTS.InReplyToIDs().Invalidate(status.InReplyToID)
+ }
+ })
+
+ c.GTS.StatusFave().SetInvalidateCallback(func(fave *gtsmodel.StatusFave) {
+ // Invalidate status fave ID list for this status.
+ c.GTS.StatusFaveIDs().Invalidate(fave.StatusID)
})
c.GTS.User().SetInvalidateCallback(func(user *gtsmodel.User) {