feat: update cache #204

This commit is contained in:
CaIon
2024-04-18 20:23:06 +08:00
parent c6e85d5b57
commit 65b85377c6
3 changed files with 13 additions and 1 deletions

View File

@@ -410,6 +410,11 @@ func ValidateAccessToken(token string) (user *User) {
func GetUserQuota(id int) (quota int, err error) {
err = DB.Model(&User{}).Where("id = ?", id).Select("quota").Find(&quota).Error
if err != nil {
if common.RedisEnabled {
go CacheSetUserQuota(id, quota)
}
}
return quota, err
}