MCPcopy
hub / github.com/QuantumNous/new-api / updateUserCache

Function updateUserCache

model/user_cache.go:67–77  ·  view source on GitHub ↗

updateUserCache updates all user cache fields using hash

(user User)

Source from the content-addressed store, hash-verified

65
66// updateUserCache updates all user cache fields using hash
67func updateUserCache(user User) error {
68 if !common.RedisEnabled {
69 return nil
70 }
71
72 return common.RedisHSetObj(
73 getUserCacheKey(user.Id),
74 user.ToBaseUser(),
75 time.Duration(common.RedisKeyCacheSeconds())*time.Second,
76 )
77}
78
79// GetUserCache gets complete user cache from hash
80func GetUserCache(userId int) (userCache *UserBase, err error) {

Callers 4

GetUserCacheFunction · 0.85
UpdateMethod · 0.85
EditMethod · 0.85
ClearBindingMethod · 0.85

Calls 4

RedisHSetObjFunction · 0.92
RedisKeyCacheSecondsFunction · 0.92
getUserCacheKeyFunction · 0.85
ToBaseUserMethod · 0.80

Tested by

no test coverage detected