summaryrefslogtreecommitdiff
path: root/internal/db/bundb/user.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-07-24 09:41:43 +0100
committerLibravatar GitHub <noreply@github.com>2024-07-24 10:41:43 +0200
commit63fc9b6c3e8a03010b662a4acad0eb6f04a11f04 (patch)
treef4bf28f78333365cbe9eeda19de4de566e475584 /internal/db/bundb/user.go
parent[feature] Allow user to set "bot" flag; show bot icon on profile (#3135) (diff)
downloadgotosocial-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/user.go')
-rw-r--r--internal/db/bundb/user.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/db/bundb/user.go b/internal/db/bundb/user.go
index f0221eeb1..1ca65f016 100644
--- a/internal/db/bundb/user.go
+++ b/internal/db/bundb/user.go
@@ -116,7 +116,7 @@ func (u *userDB) GetUserByConfirmationToken(ctx context.Context, token string) (
func (u *userDB) getUser(ctx context.Context, lookup string, dbQuery func(*gtsmodel.User) error, keyParts ...any) (*gtsmodel.User, error) {
// Fetch user from database cache with loader callback.
- user, err := u.state.Caches.GTS.User.LoadOne(lookup, func() (*gtsmodel.User, error) {
+ user, err := u.state.Caches.DB.User.LoadOne(lookup, func() (*gtsmodel.User, error) {
var user gtsmodel.User
// Not cached! perform database query.
@@ -179,7 +179,7 @@ func (u *userDB) GetAllUsers(ctx context.Context) ([]*gtsmodel.User, error) {
}
func (u *userDB) PutUser(ctx context.Context, user *gtsmodel.User) error {
- return u.state.Caches.GTS.User.Store(user, func() error {
+ return u.state.Caches.DB.User.Store(user, func() error {
_, err := u.db.
NewInsert().
Model(user).
@@ -197,7 +197,7 @@ func (u *userDB) UpdateUser(ctx context.Context, user *gtsmodel.User, columns ..
columns = append(columns, "updated_at")
}
- return u.state.Caches.GTS.User.Store(user, func() error {
+ return u.state.Caches.DB.User.Store(user, func() error {
_, err := u.db.
NewUpdate().
Model(user).
@@ -209,7 +209,7 @@ func (u *userDB) UpdateUser(ctx context.Context, user *gtsmodel.User, columns ..
}
func (u *userDB) DeleteUserByID(ctx context.Context, userID string) error {
- defer u.state.Caches.GTS.User.Invalidate("ID", userID)
+ defer u.state.Caches.DB.User.Invalidate("ID", userID)
// Load user into cache before attempting a delete,
// as we need it cached in order to trigger the invalidate