mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-15 08:43:01 -06:00
[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:
parent
325b4a2b4a
commit
63fc9b6c3e
39 changed files with 376 additions and 378 deletions
|
|
@ -147,7 +147,7 @@ func (r *reportDB) GetReports(ctx context.Context, resolved *bool, accountID str
|
|||
|
||||
func (r *reportDB) getReport(ctx context.Context, lookup string, dbQuery func(*gtsmodel.Report) error, keyParts ...any) (*gtsmodel.Report, error) {
|
||||
// Fetch report from database cache with loader callback
|
||||
report, err := r.state.Caches.GTS.Report.LoadOne(lookup, func() (*gtsmodel.Report, error) {
|
||||
report, err := r.state.Caches.DB.Report.LoadOne(lookup, func() (*gtsmodel.Report, error) {
|
||||
var report gtsmodel.Report
|
||||
|
||||
// Not cached! Perform database query
|
||||
|
|
@ -242,7 +242,7 @@ func (r *reportDB) PopulateReport(ctx context.Context, report *gtsmodel.Report)
|
|||
}
|
||||
|
||||
func (r *reportDB) PutReport(ctx context.Context, report *gtsmodel.Report) error {
|
||||
return r.state.Caches.GTS.Report.Store(report, func() error {
|
||||
return r.state.Caches.DB.Report.Store(report, func() error {
|
||||
_, err := r.db.NewInsert().Model(report).Exec(ctx)
|
||||
return err
|
||||
})
|
||||
|
|
@ -264,12 +264,12 @@ func (r *reportDB) UpdateReport(ctx context.Context, report *gtsmodel.Report, co
|
|||
return nil, err
|
||||
}
|
||||
|
||||
r.state.Caches.GTS.Report.Invalidate("ID", report.ID)
|
||||
r.state.Caches.DB.Report.Invalidate("ID", report.ID)
|
||||
return report, nil
|
||||
}
|
||||
|
||||
func (r *reportDB) DeleteReportByID(ctx context.Context, id string) error {
|
||||
defer r.state.Caches.GTS.Report.Invalidate("ID", id)
|
||||
defer r.state.Caches.DB.Report.Invalidate("ID", id)
|
||||
|
||||
// Load status into cache before attempting a delete,
|
||||
// as we need it cached in order to trigger the invalidate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue