diff options
author | 2024-07-24 09:41:43 +0100 | |
---|---|---|
committer | 2024-07-24 10:41:43 +0200 | |
commit | 63fc9b6c3e8a03010b662a4acad0eb6f04a11f04 (patch) | |
tree | f4bf28f78333365cbe9eeda19de4de566e475584 /internal/db/bundb/mention.go | |
parent | [feature] Allow user to set "bot" flag; show bot icon on profile (#3135) (diff) | |
download | gotosocial-63fc9b6c3e8a03010b662a4acad0eb6f04a11f04.tar.xz |
[chore] renames the `GTS` caches to `DB` caches (#3127)
* renames the `GTS` caches to `DB` caches, as it better references what they are
* change remaining Caches.GTS uses to Caches.DB
Diffstat (limited to 'internal/db/bundb/mention.go')
-rw-r--r-- | internal/db/bundb/mention.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/db/bundb/mention.go b/internal/db/bundb/mention.go index 559e9515c..877091296 100644 --- a/internal/db/bundb/mention.go +++ b/internal/db/bundb/mention.go @@ -38,7 +38,7 @@ type mentionDB struct { } func (m *mentionDB) GetMention(ctx context.Context, id string) (*gtsmodel.Mention, error) { - mention, err := m.state.Caches.GTS.Mention.LoadOne("ID", func() (*gtsmodel.Mention, error) { + mention, err := m.state.Caches.DB.Mention.LoadOne("ID", func() (*gtsmodel.Mention, error) { var mention gtsmodel.Mention q := m.db. @@ -66,7 +66,7 @@ func (m *mentionDB) GetMention(ctx context.Context, id string) (*gtsmodel.Mentio func (m *mentionDB) GetMentions(ctx context.Context, ids []string) ([]*gtsmodel.Mention, error) { // Load all mention IDs via cache loader callbacks. - mentions, err := m.state.Caches.GTS.Mention.LoadIDs("ID", + mentions, err := m.state.Caches.DB.Mention.LoadIDs("ID", ids, func(uncached []string) ([]*gtsmodel.Mention, error) { // Preallocate expected length of uncached mentions. @@ -152,14 +152,14 @@ func (m *mentionDB) PopulateMention(ctx context.Context, mention *gtsmodel.Menti } func (m *mentionDB) PutMention(ctx context.Context, mention *gtsmodel.Mention) error { - return m.state.Caches.GTS.Mention.Store(mention, func() error { + return m.state.Caches.DB.Mention.Store(mention, func() error { _, err := m.db.NewInsert().Model(mention).Exec(ctx) return err }) } func (m *mentionDB) DeleteMentionByID(ctx context.Context, id string) error { - defer m.state.Caches.GTS.Mention.Invalidate("ID", id) + defer m.state.Caches.DB.Mention.Invalidate("ID", id) // Load mention into cache before attempting a delete, // as we need it cached in order to trigger the invalidate |