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

Function logQuotaDataCache

model/usedata.go:42–61  ·  view source on GitHub ↗
(userId int, username string, modelName string, quota int, createdAt int64, tokenUsed int)

Source from the content-addressed store, hash-verified

40var CacheQuotaDataLock = sync.Mutex{}
41
42func logQuotaDataCache(userId int, username string, modelName string, quota int, createdAt int64, tokenUsed int) {
43 key := fmt.Sprintf("%d-%s-%s-%d", userId, username, modelName, createdAt)
44 quotaData, ok := CacheQuotaData[key]
45 if ok {
46 quotaData.Count += 1
47 quotaData.Quota += quota
48 quotaData.TokenUsed += tokenUsed
49 } else {
50 quotaData = &QuotaData{
51 UserID: userId,
52 Username: username,
53 ModelName: modelName,
54 CreatedAt: createdAt,
55 Count: 1,
56 Quota: quota,
57 TokenUsed: tokenUsed,
58 }
59 }
60 CacheQuotaData[key] = quotaData
61}
62
63func LogQuotaData(userId int, username string, modelName string, quota int, createdAt int64, tokenUsed int) {
64 // 只精确到小时

Callers 1

LogQuotaDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected