fix: update cache immediately after cache get

Co-authored-by: chikasaki <1347283135@qq.com>
Co-authored-by: Cruel <157922018@qq.com>
This commit is contained in:
JustSong
2023-08-16 23:40:24 +08:00
parent 90b4cac7f3
commit 86c2627c24
3 changed files with 18 additions and 1 deletions

View File

@@ -95,6 +95,14 @@ func CacheUpdateUserQuota(id int) error {
return err
}
func CacheDecreaseUserQuota(id int, quota int) error {
if !common.RedisEnabled {
return nil
}
err := common.RedisDecrease(fmt.Sprintf("user_quota:%d", id), int64(quota))
return err
}
func CacheIsUserEnabled(userId int) bool {
if !common.RedisEnabled {
return IsUserEnabled(userId)