Documentation ¶
Index ¶
- func AddOnlineAccount(accountId int64, playerId int64, gameServerId int32) bool
- func AddOnlinePlayer(playerId, accountId int64, gameServerId int32) bool
- func Get() gentity.KvCache
- func GetOnlineAccount(accountId int64) (playerId int64, gameServerId int32)
- func GetOnlinePlayer(playerId int64) (accountId int64, gameServerId int32)
- func GetRedis() redis.Cmdable
- func IsRedisError(redisError error) bool
- func NewLoginSession(account *pb.Account) string
- func NewRedis(addrs []string, userName, password string, isCluster bool) redis.Cmdable
- func NewRedisClient(addrs []string, userName, password string) redis.Cmdable
- func NewRedisSingleClient(addr string, userName, password string) redis.Cmdable
- func RemoveOnlineAccount(accountId int64) bool
- func RemoveOnlinePlayer(playerId int64, gameServerId int32) bool
- func ResetOnlinePlayer(gameServerId int32, repairFunc func(playerId, accountId int64) error)
- func VerifyLoginSession(accountId int64, session string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOnlineAccount ¶
添加一个在线账号
func AddOnlinePlayer ¶
添加一个在线玩家 缓存玩家和游戏服的对应关系,这样在分布式系统里,可以知道某个玩家当前在哪一台gameServer上
func GetOnlineAccount ¶
获取在线账号对应的玩家id 返回0表示账号不在线
func GetOnlinePlayer ¶
获取一个在线玩家当前所在的游戏服id
func NewRedisClient ¶
初始化redis集群 集群不支持事务,但是可以用lua script实现同节点上的原子操作,达到类似事务的效果
func NewRedisSingleClient ¶
单机模式的redis
func ResetOnlinePlayer ¶
重置一个服务器上的在线玩家缓存
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.