summaryrefslogtreecommitdiff
path: root/internal/cache/cache.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-06-06 10:44:43 +0000
committerLibravatar GitHub <noreply@github.com>2024-06-06 11:44:43 +0100
commit5dcc954072ca0a27107ed3fdc6806986f61df7d0 (patch)
tree7a6380bf39e99dbcfee4fbe1434697706637d2bc /internal/cache/cache.go
parent[bugfix] Don't nil emojis + fields on blocked accounts (#2968) (diff)
downloadgotosocial-5dcc954072ca0a27107ed3fdc6806986f61df7d0.tar.xz
[feature] do not uncache status / emoji media if attached status is bookmarked (#2956)
* do not uncache status / emoji media if attached status is bookmarked * add status bookmark and bookmark IDs caches * update status bookmark tests * move IsStatusBookmarkedBy() to StatusBookmark{} interface, rely on cache * fix envparsing.sh test
Diffstat (limited to 'internal/cache/cache.go')
-rw-r--r--internal/cache/cache.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/cache/cache.go b/internal/cache/cache.go
index 2c15d836d..2af5e20ca 100644
--- a/internal/cache/cache.go
+++ b/internal/cache/cache.go
@@ -85,6 +85,8 @@ func (c *Caches) Init() {
c.initPollVoteIDs()
c.initReport()
c.initStatus()
+ c.initStatusBookmark()
+ c.initStatusBookmarkIDs()
c.initStatusFave()
c.initStatusFaveIDs()
c.initTag()
@@ -101,7 +103,7 @@ func (c *Caches) Init() {
func (c *Caches) Start() {
log.Infof(nil, "start: %p", c)
- tryUntil("starting *gtsmodel.Webfinger cache", 5, func() bool {
+ tryUntil("starting webfinger cache", 5, func() bool {
return c.GTS.Webfinger.Start(5 * time.Minute)
})
}
@@ -111,7 +113,7 @@ func (c *Caches) Start() {
func (c *Caches) Stop() {
log.Infof(nil, "stop: %p", c)
- tryUntil("stopping *gtsmodel.Webfinger cache", 5, c.GTS.Webfinger.Stop)
+ tryUntil("stopping webfinger cache", 5, c.GTS.Webfinger.Stop)
}
// Sweep will sweep all the available caches to ensure none
@@ -153,6 +155,8 @@ func (c *Caches) Sweep(threshold float64) {
c.GTS.PollVoteIDs.Trim(threshold)
c.GTS.Report.Trim(threshold)
c.GTS.Status.Trim(threshold)
+ c.GTS.StatusBookmark.Trim(threshold)
+ c.GTS.StatusBookmarkIDs.Trim(threshold)
c.GTS.StatusFave.Trim(threshold)
c.GTS.StatusFaveIDs.Trim(threshold)
c.GTS.Tag.Trim(threshold)