package db import ( "sync/atomic" "time" "github.com/goburrow/cache" ) var ( // uid总数 uidCount atomic.Int64 // 启服加载后不能设置过期 // uid缓存 key:uid, value:playerID uidCache = cache.New( cache.WithMaximumSize(-1), ) // 启服加载后不能设置过期 // 玩家名缓存 key:playerName, value:playerID playerNameCache = cache.New( cache.WithMaximumSize(-1), ) ) // UIDCount uid总数 func UIDCount() int64 { return uidCount.Load() } var ( // 节点信息表 nodeTableCache = cache.New( cache.WithMaximumSize(-1), ) // 玩家表缓存 key:playerID, value:*PlayerTable playerTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) // 道具表缓存 key:playerID, value:*ItemTable itemTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) //任务表缓存 key:playerID, value:*QuestTable questTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) //邮件表缓存 key:playerID, value:*MailTable mailTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) // 英雄表缓存 key:playerID, value:*HeroTable heroTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) // 装备表缓存 key:playerID, value:*EquipTable equipTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) // 阵容表缓存 key:playerID, value:*LineupTable lineupTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) // 聊天表缓存 key:playerID, value:*ChatTable chatTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) // 探险表缓存 key:playerID, value:*ChapterTable chapterTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) // 商店表缓存 key:playerID, value:*shopTable shopTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) // 跑马灯信息表 marqueeTableCache = cache.New( cache.WithMaximumSize(-1), ) ) var ( // 支付订单表 key:order_id, value:order orderTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(2*time.Minute), ) // 充值表 key:playerID, value:*ChargeTable chargeTableCache = cache.New( cache.WithMaximumSize(-1), cache.WithExpireAfterAccess(1*time.Hour), ) )