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/notification.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/notification.go')
-rw-r--r-- | internal/db/bundb/notification.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/db/bundb/notification.go b/internal/db/bundb/notification.go index d5a96dd2d..1103bb6a0 100644 --- a/internal/db/bundb/notification.go +++ b/internal/db/bundb/notification.go @@ -76,7 +76,7 @@ func (n *notificationDB) GetNotification( func (n *notificationDB) getNotification(ctx context.Context, lookup string, dbQuery func(*gtsmodel.Notification) error, keyParts ...any) (*gtsmodel.Notification, error) { // Fetch notification from cache with loader callback - notif, err := n.state.Caches.GTS.Notification.LoadOne(lookup, func() (*gtsmodel.Notification, error) { + notif, err := n.state.Caches.DB.Notification.LoadOne(lookup, func() (*gtsmodel.Notification, error) { var notif gtsmodel.Notification // Not cached! Perform database query @@ -104,7 +104,7 @@ func (n *notificationDB) getNotification(ctx context.Context, lookup string, dbQ func (n *notificationDB) GetNotificationsByIDs(ctx context.Context, ids []string) ([]*gtsmodel.Notification, error) { // Load all notif IDs via cache loader callbacks. - notifs, err := n.state.Caches.GTS.Notification.LoadIDs("ID", + notifs, err := n.state.Caches.DB.Notification.LoadIDs("ID", ids, func(uncached []string) ([]*gtsmodel.Notification, error) { // Skip query if everything was cached. @@ -285,7 +285,7 @@ func (n *notificationDB) GetAccountNotifications( } func (n *notificationDB) PutNotification(ctx context.Context, notif *gtsmodel.Notification) error { - return n.state.Caches.GTS.Notification.Store(notif, func() error { + return n.state.Caches.DB.Notification.Store(notif, func() error { _, err := n.db.NewInsert().Model(notif).Exec(ctx) return err }) @@ -302,7 +302,7 @@ func (n *notificationDB) DeleteNotificationByID(ctx context.Context, id string) } // Invalidate deleted notification by ID. - n.state.Caches.GTS.Notification.Invalidate("ID", id) + n.state.Caches.DB.Notification.Invalidate("ID", id) return nil } @@ -337,7 +337,7 @@ func (n *notificationDB) DeleteNotifications(ctx context.Context, types []string } // Invalidate all deleted notifications by IDs. - n.state.Caches.GTS.Notification.InvalidateIDs("ID", notifIDs) + n.state.Caches.DB.Notification.InvalidateIDs("ID", notifIDs) return nil } @@ -354,6 +354,6 @@ func (n *notificationDB) DeleteNotificationsForStatus(ctx context.Context, statu } // Invalidate all deleted notifications by IDs. - n.state.Caches.GTS.Notification.InvalidateIDs("ID", notifIDs) + n.state.Caches.DB.Notification.InvalidateIDs("ID", notifIDs) return nil } |