package cachekey import "fmt" const ( UserApiPermissionsPattern = "user:api:permissions:*" UserInfoPattern = "user:info:*" UserAuthStatePattern = "user:auth_state:*" AuthRefreshPattern = "auth:refresh:*" // 新增:覆盖 和 user: 两种 key ) func UserApiPermissions(id int32) string { return fmt.Sprintf("user:api:permissions:%d", id) } func UserInfo(id int32) string { return fmt.Sprintf("user:info:%d", id) } func AuthRefresh(hash string) string { return fmt.Sprintf("auth:refresh:%s", hash) } // AuthRefreshUser 反向索引 用于定位refresh token来删除 func AuthRefreshUser(userID int32) string { return fmt.Sprintf("auth:refresh:user:%d", userID) } func UserAuthState(id int32) string { return fmt.Sprintf("user:auth_state:%d", id) }