2026-03-04 13:45:49 +08:00
|
|
|
package admin
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var accountTodayStatsBatchCache = newSnapshotCache(30 * time.Second)
|
|
|
|
|
|
|
|
|
|
func buildAccountTodayStatsBatchCacheKey(accountIDs []int64) string {
|
|
|
|
|
if len(accountIDs) == 0 {
|
|
|
|
|
return "accounts_today_stats_empty"
|
|
|
|
|
}
|
|
|
|
|
var b strings.Builder
|
|
|
|
|
b.Grow(len(accountIDs) * 6)
|
2026-03-04 14:07:17 +08:00
|
|
|
_, _ = b.WriteString("accounts_today_stats:")
|
2026-03-04 13:45:49 +08:00
|
|
|
for i, id := range accountIDs {
|
|
|
|
|
if i > 0 {
|
2026-03-04 14:07:17 +08:00
|
|
|
_ = b.WriteByte(',')
|
2026-03-04 13:45:49 +08:00
|
|
|
}
|
2026-03-04 14:07:17 +08:00
|
|
|
_, _ = b.WriteString(strconv.FormatInt(id, 10))
|
2026-03-04 13:45:49 +08:00
|
|
|
}
|
|
|
|
|
return b.String()
|
|
|
|
|
}
|