- 删除 account_today_stats_cache.go 中重复的 normalizeAccountIDList,统一使用 id_list_utils.go 的 normalizeInt64IDList - 新增 snapshot_cache_test.go:覆盖 snapshotCache、buildETagFromAny、parseBoolQueryWithDefault - 新增 id_list_utils_test.go:覆盖 normalizeInt64IDList、buildAccountTodayStatsBatchCacheKey - 新增 ops_query_mode_test.go:覆盖 shouldFallbackOpsPreagg、cloneOpsFilterWithMode
26 lines
512 B
Go
26 lines
512 B
Go
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)
|
|
_, _ = b.WriteString("accounts_today_stats:")
|
|
for i, id := range accountIDs {
|
|
if i > 0 {
|
|
_ = b.WriteByte(',')
|
|
}
|
|
_, _ = b.WriteString(strconv.FormatInt(id, 10))
|
|
}
|
|
return b.String()
|
|
}
|