MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / cacheSetToken

Function cacheSetToken

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

Source from the content-addressed store, hash-verified

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

Callers 5

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

Calls 4

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

Tested by

no test coverage detected