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/conversation.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/conversation.go')
-rw-r--r-- | internal/db/bundb/conversation.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/db/bundb/conversation.go b/internal/db/bundb/conversation.go index 1a3958a79..b86ec530c 100644 --- a/internal/db/bundb/conversation.go +++ b/internal/db/bundb/conversation.go @@ -82,7 +82,7 @@ func (c *conversationDB) getConversation( keyParts ...any, ) (*gtsmodel.Conversation, error) { // Fetch conversation from cache with loader callback - conversation, err := c.state.Caches.GTS.Conversation.LoadOne(lookup, func() (*gtsmodel.Conversation, error) { + conversation, err := c.state.Caches.DB.Conversation.LoadOne(lookup, func() (*gtsmodel.Conversation, error) { var conversation gtsmodel.Conversation // Not cached! Perform database query @@ -157,7 +157,7 @@ func (c *conversationDB) GetConversationsByOwnerAccountID(ctx context.Context, a } func (c *conversationDB) getAccountConversationLastStatusIDs(ctx context.Context, accountID string, page *paging.Page) ([]string, error) { - return loadPagedIDs(&c.state.Caches.GTS.ConversationLastStatusIDs, accountID, page, func() ([]string, error) { + return loadPagedIDs(&c.state.Caches.DB.ConversationLastStatusIDs, accountID, page, func() ([]string, error) { var conversationLastStatusIDs []string // Conversation last status IDs not in cache. Perform DB query. @@ -182,7 +182,7 @@ func (c *conversationDB) getConversationsByLastStatusIDs( conversationLastStatusIDs []string, ) ([]*gtsmodel.Conversation, error) { // Load all conversation IDs via cache loader callbacks. - conversations, err := c.state.Caches.GTS.Conversation.LoadIDs2Part( + conversations, err := c.state.Caches.DB.Conversation.LoadIDs2Part( "AccountID,LastStatusID", accountID, conversationLastStatusIDs, @@ -233,7 +233,7 @@ func (c *conversationDB) UpsertConversation(ctx context.Context, conversation *g columns = append(columns, "updated_at") } - return c.state.Caches.GTS.Conversation.Store(conversation, func() error { + return c.state.Caches.DB.Conversation.Store(conversation, func() error { _, err := NewUpsert(c.db). Model(conversation). Constraint("id"). @@ -272,7 +272,7 @@ func (c *conversationDB) DeleteConversationByID(ctx context.Context, id string) } // Drop this now-cached conversation on return after delete. - defer c.state.Caches.GTS.Conversation.Invalidate("ID", id) + defer c.state.Caches.DB.Conversation.Invalidate("ID", id) // Finally delete conversation from DB. _, err = c.db.NewDelete(). @@ -288,10 +288,10 @@ func (c *conversationDB) DeleteConversationsByOwnerAccountID(ctx context.Context // Conversation invalidate hooks only invalidate the conversation ID cache, // so we don't need to load all conversations into the cache to run invalidation hooks, // as with some other object types (blocks, for example). - c.state.Caches.GTS.Conversation.Invalidate("AccountID", accountID) + c.state.Caches.DB.Conversation.Invalidate("AccountID", accountID) // In case there were no cached conversations, // explicitly invalidate the user's conversation last status ID cache. - c.state.Caches.GTS.ConversationLastStatusIDs.Invalidate(accountID) + c.state.Caches.DB.ConversationLastStatusIDs.Invalidate(accountID) }() return c.db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { @@ -488,7 +488,7 @@ func (c *conversationDB) DeleteStatusFromConversations(ctx context.Context, stat } updatedConversationIDs = append(updatedConversationIDs, deletedConversationIDs...) - c.state.Caches.GTS.Conversation.InvalidateIDs("ID", updatedConversationIDs) + c.state.Caches.DB.Conversation.InvalidateIDs("ID", updatedConversationIDs) return nil } |