diff options
Diffstat (limited to 'internal/db/bundb/emoji.go')
-rw-r--r-- | internal/db/bundb/emoji.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/db/bundb/emoji.go b/internal/db/bundb/emoji.go index 2316e7d71..a14d1258c 100644 --- a/internal/db/bundb/emoji.go +++ b/internal/db/bundb/emoji.go @@ -43,7 +43,7 @@ type emojiDB struct { } func (e *emojiDB) PutEmoji(ctx context.Context, emoji *gtsmodel.Emoji) error { - return e.state.Caches.GTS.Emoji.Store(emoji, func() error { + return e.state.Caches.DB.Emoji.Store(emoji, func() error { _, err := e.db.NewInsert().Model(emoji).Exec(ctx) return err }) @@ -57,7 +57,7 @@ func (e *emojiDB) UpdateEmoji(ctx context.Context, emoji *gtsmodel.Emoji, column } // Update the emoji model in the database. - return e.state.Caches.GTS.Emoji.Store(emoji, func() error { + return e.state.Caches.DB.Emoji.Store(emoji, func() error { _, err := e.db. NewUpdate(). Model(emoji). @@ -76,11 +76,11 @@ func (e *emojiDB) DeleteEmojiByID(ctx context.Context, id string) error { defer func() { // Invalidate cached emoji. - e.state.Caches.GTS.Emoji.Invalidate("ID", id) + e.state.Caches.DB.Emoji.Invalidate("ID", id) // Invalidate cached account and status IDs. - e.state.Caches.GTS.Account.InvalidateIDs("ID", accountIDs) - e.state.Caches.GTS.Status.InvalidateIDs("ID", statusIDs) + e.state.Caches.DB.Account.InvalidateIDs("ID", accountIDs) + e.state.Caches.DB.Status.InvalidateIDs("ID", statusIDs) }() // Load emoji into cache before attempting a delete, @@ -477,7 +477,7 @@ func (e *emojiDB) GetEmojiByStaticURL(ctx context.Context, imageStaticURL string } func (e *emojiDB) PutEmojiCategory(ctx context.Context, emojiCategory *gtsmodel.EmojiCategory) error { - return e.state.Caches.GTS.EmojiCategory.Store(emojiCategory, func() error { + return e.state.Caches.DB.EmojiCategory.Store(emojiCategory, func() error { _, err := e.db.NewInsert().Model(emojiCategory).Exec(ctx) return err }) @@ -529,7 +529,7 @@ func (e *emojiDB) GetEmojiCategoryByName(ctx context.Context, name string) (*gts func (e *emojiDB) getEmoji(ctx context.Context, lookup string, dbQuery func(*gtsmodel.Emoji) error, keyParts ...any) (*gtsmodel.Emoji, error) { // Fetch emoji from database cache with loader callback - emoji, err := e.state.Caches.GTS.Emoji.LoadOne(lookup, func() (*gtsmodel.Emoji, error) { + emoji, err := e.state.Caches.DB.Emoji.LoadOne(lookup, func() (*gtsmodel.Emoji, error) { var emoji gtsmodel.Emoji // Not cached! Perform database query @@ -583,7 +583,7 @@ func (e *emojiDB) GetEmojisByIDs(ctx context.Context, ids []string) ([]*gtsmodel } // Load all emoji IDs via cache loader callbacks. - emojis, err := e.state.Caches.GTS.Emoji.LoadIDs("ID", + emojis, err := e.state.Caches.DB.Emoji.LoadIDs("ID", ids, func(uncached []string) ([]*gtsmodel.Emoji, error) { // Preallocate expected length of uncached emojis. @@ -629,7 +629,7 @@ func (e *emojiDB) GetEmojisByIDs(ctx context.Context, ids []string) ([]*gtsmodel } func (e *emojiDB) getEmojiCategory(ctx context.Context, lookup string, dbQuery func(*gtsmodel.EmojiCategory) error, keyParts ...any) (*gtsmodel.EmojiCategory, error) { - return e.state.Caches.GTS.EmojiCategory.LoadOne(lookup, func() (*gtsmodel.EmojiCategory, error) { + return e.state.Caches.DB.EmojiCategory.LoadOne(lookup, func() (*gtsmodel.EmojiCategory, error) { var category gtsmodel.EmojiCategory // Not cached! Perform database query @@ -647,7 +647,7 @@ func (e *emojiDB) GetEmojiCategoriesByIDs(ctx context.Context, ids []string) ([] } // Load all category IDs via cache loader callbacks. - categories, err := e.state.Caches.GTS.EmojiCategory.LoadIDs("ID", + categories, err := e.state.Caches.DB.EmojiCategory.LoadIDs("ID", ids, func(uncached []string) ([]*gtsmodel.EmojiCategory, error) { // Preallocate expected length of uncached categories. |