From faed35c9388bc28ea0fdfe3aae3b489ca952c006 Mon Sep 17 00:00:00 2001 From: kim Date: Sat, 31 May 2025 17:30:57 +0200 Subject: [performance] cache mute check results (#4202) This separates our the user mute handling from the typeconverter code, and creates a new "mutes" filter type (in a similar vein to the visibility filter) subpkg with its own result cache. This is a heavy mix of both chore given that mute calculation shouldn't have been handled in the conversion to frontend API types, and a performance bonus since we don't need to load and calculate so many things each time, just the single result each time with all necessary invalidation handled by database cache hooks. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4202 Co-authored-by: kim Co-committed-by: kim --- internal/cache/cache.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'internal/cache/cache.go') diff --git a/internal/cache/cache.go b/internal/cache/cache.go index d05b85a15..54777441f 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -49,6 +49,10 @@ type Caches struct { // Timelines ... Timelines TimelineCaches + // Mutes provides access to the item mutes + // cache. (used by the item mutes filter). + Mutes MutesCache + // Visibility provides access to the item visibility // cache. (used by the visibility filter). Visibility VisibilityCache @@ -125,6 +129,7 @@ func (c *Caches) Init() { c.initWebfinger() c.initWebPushSubscription() c.initWebPushSubscriptionIDs() + c.initMutes() c.initVisibility() } -- cgit v1.2.3