MCPcopy Create free account
hub / github.com/QuantumNous/new-api / cacheSetToken

Function cacheSetToken

model/token_cache.go:11–19  ·  view source on GitHub ↗
(token Token)

Source from the content-addressed store, hash-verified

9)
10
11func cacheSetToken(token Token) error {
12 key := common.GenerateHMAC(token.Key)
13 token.Clean()
14 err := common.RedisHSetObj(fmt.Sprintf("token:%s", key), &token, time.Duration(common.RedisKeyCacheSeconds())*time.Second)
15 if err != nil {
16 return err
17 }
18 return nil
19}
20
21func cacheDeleteToken(key string) error {
22 key = common.GenerateHMAC(key)

Callers 4

GetTokenByIdFunction · 0.85
GetTokenByKeyFunction · 0.85
UpdateMethod · 0.85
SelectUpdateMethod · 0.85

Calls 4

GenerateHMACFunction · 0.92
RedisHSetObjFunction · 0.92
RedisKeyCacheSecondsFunction · 0.92
CleanMethod · 0.80

Tested by

no test coverage detected