(userId int)
| 112 | } |
| 113 | |
| 114 | func cacheGetUserBase(userId int) (*UserBase, error) { |
| 115 | if !common.RedisEnabled { |
| 116 | return nil, fmt.Errorf("redis is not enabled") |
| 117 | } |
| 118 | var userCache UserBase |
| 119 | // Try getting from Redis first |
| 120 | err := common.RedisHGetObj(getUserCacheKey(userId), &userCache) |
| 121 | if err != nil { |
| 122 | return nil, err |
| 123 | } |
| 124 | return &userCache, nil |
| 125 | } |
| 126 | |
| 127 | // Add atomic quota operations using hash fields |
| 128 | func cacheIncrUserQuota(userId int, delta int64) error { |
no test coverage detected