diff options
| author | 2025-10-15 13:32:02 +0200 | |
|---|---|---|
| committer | 2025-10-17 15:33:35 +0200 | |
| commit | 2bdff66f0a12a16684e5d25bcace551446ec1c78 (patch) | |
| tree | 4a667a71f97d6d2d52d5b3dae1e56d74192219b3 /internal/cache/db.go | |
| parent | [chore/performance] Use CTE for list select statuses query (#4501) (diff) | |
| download | gotosocial-2bdff66f0a12a16684e5d25bcace551446ec1c78.tar.xz | |
[performance] cache account IDs in home timeline query not in exclusive lists (#4502)
this caches the stage of the home timeline query in which we calculate which account IDs should be shown in a particular user's timeline.
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4502
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/cache/db.go')
| -rw-r--r-- | internal/cache/db.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/cache/db.go b/internal/cache/db.go index 8a8f59539..d5f25516b 100644 --- a/internal/cache/db.go +++ b/internal/cache/db.go @@ -145,6 +145,10 @@ type DBCaches struct { // FollowingTagIDs SliceCache[string] + // HomeAccountIDs provides access to the account IDs present in an account's + // home timeline, bearing in mind that some may be part of exclusive lists. + HomeAccountIDs SliceCache[string] + // Instance provides access to the gtsmodel Instance database cache. Instance StructCache[*gtsmodel.Instance] @@ -883,6 +887,17 @@ func (c *Caches) initFollowingTagIDs() { c.DB.FollowingTagIDs.Init(0, cap) } +func (c *Caches) initHomeAccountIDs() { + // Calculate maximum cache size. + cap := calculateSliceCacheMax( + config.GetCacheHomeAccountIDsMemRatio(), + ) + + log.Infof(nil, "cache size = %d", cap) + + c.DB.HomeAccountIDs.Init(0, cap) +} + func (c *Caches) initInReplyToIDs() { // Calculate maximum cache size. cap := calculateSliceCacheMax( |
