account_today_stats_cache.go 512 B

12345678910111213141516171819202122232425
  1. package admin
  2. import (
  3. "strconv"
  4. "strings"
  5. "time"
  6. )
  7. var accountTodayStatsBatchCache = newSnapshotCache(30 * time.Second)
  8. func buildAccountTodayStatsBatchCacheKey(accountIDs []int64) string {
  9. if len(accountIDs) == 0 {
  10. return "accounts_today_stats_empty"
  11. }
  12. var b strings.Builder
  13. b.Grow(len(accountIDs) * 6)
  14. _, _ = b.WriteString("accounts_today_stats:")
  15. for i, id := range accountIDs {
  16. if i > 0 {
  17. _ = b.WriteByte(',')
  18. }
  19. _, _ = b.WriteString(strconv.FormatInt(id, 10))
  20. }
  21. return b.String()
  22. }