diff options
| author | 2022-10-03 10:46:11 +0200 | |
|---|---|---|
| committer | 2022-10-03 10:46:11 +0200 | |
| commit | 56f53a2a6f85876485e2ae67d48b78b448caed6e (patch) | |
| tree | 9bd8d3fcaffd515d3dc90ff22c6cee17e8d0b073 /internal/db/bundb/bundb.go | |
| parent | [feature] Enlarge active/hovered custom emojis in statuses (#877) (diff) | |
| download | gotosocial-56f53a2a6f85876485e2ae67d48b78b448caed6e.tar.xz | |
[performance] add user cache and database (#879)
* go fmt
* add + use user cache and database
* fix import
* update tests
* remove unused relation
Diffstat (limited to 'internal/db/bundb/bundb.go')
| -rw-r--r-- | internal/db/bundb/bundb.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/internal/db/bundb/bundb.go b/internal/db/bundb/bundb.go index 1579fae76..70a44d4c1 100644 --- a/internal/db/bundb/bundb.go +++ b/internal/db/bundb/bundb.go @@ -87,6 +87,7 @@ type DBService struct { db.Session db.Status db.Timeline + db.User conn *DBConn } @@ -181,13 +182,15 @@ func NewBunDBService(ctx context.Context) (db.DB, error) { notifCache.SetTTL(time.Minute*5, false) notifCache.Start(time.Second * 10) - // Prepare domain block cache + // Prepare other caches blockCache := cache.NewDomainBlockCache() + userCache := cache.NewUserCache() ps := &DBService{ Account: accounts, Admin: &adminDB{ - conn: conn, + conn: conn, + userCache: userCache, }, Basic: &basicDB{ conn: conn, @@ -219,7 +222,11 @@ func NewBunDBService(ctx context.Context) (db.DB, error) { }, Status: status, Timeline: timeline, - conn: conn, + User: &userDB{ + conn: conn, + cache: userCache, + }, + conn: conn, } // we can confidently return this useable service now |
