refactor: Optimize user caching and token retrieval methods

This commit is contained in:
1808837298@qq.com
2025-02-19 15:12:26 +08:00
parent 0907a078b4
commit b1847509a4
7 changed files with 21 additions and 8 deletions

View File

@@ -52,7 +52,7 @@ func cacheSetTokenField(key string, field string, value string) error {
func cacheGetTokenByKey(key string) (*Token, error) {
hmacKey := common.GenerateHMAC(key)
if !common.RedisEnabled {
return nil, nil
return nil, fmt.Errorf("redis is not enabled")
}
var token Token
err := common.RedisHGetObj(fmt.Sprintf("token:%s", hmacKey), &token)