[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
This commit is contained in:
kim 2024-07-24 09:41:43 +01:00 committed by GitHub
commit 63fc9b6c3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 376 additions and 378 deletions

View file

@ -73,7 +73,7 @@ func (r *interactionDB) getInteractionApproval(
keyParts ...any,
) (*gtsmodel.InteractionApproval, error) {
// Fetch approval from database cache with loader callback
approval, err := r.state.Caches.GTS.InteractionApproval.LoadOne(lookup, func() (*gtsmodel.InteractionApproval, error) {
approval, err := r.state.Caches.DB.InteractionApproval.LoadOne(lookup, func() (*gtsmodel.InteractionApproval, error) {
var approval gtsmodel.InteractionApproval
// Not cached! Perform database query
@ -132,14 +132,14 @@ func (r *interactionDB) PopulateInteractionApproval(ctx context.Context, approva
}
func (r *interactionDB) PutInteractionApproval(ctx context.Context, approval *gtsmodel.InteractionApproval) error {
return r.state.Caches.GTS.InteractionApproval.Store(approval, func() error {
return r.state.Caches.DB.InteractionApproval.Store(approval, func() error {
_, err := r.db.NewInsert().Model(approval).Exec(ctx)
return err
})
}
func (r *interactionDB) DeleteInteractionApprovalByID(ctx context.Context, id string) error {
defer r.state.Caches.GTS.InteractionApproval.Invalidate("ID", id)
defer r.state.Caches.DB.InteractionApproval.Invalidate("ID", id)
_, err := r.db.NewDelete().
TableExpr("? AS ?", bun.Ident("interaction_approvals"), bun.Ident("interaction_approval")).