cache

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBlackList

func AddBlackList(playerid int64, ttl int64) error

AddBlackList 加入黑名单

func AddPlayerSyncDB

func AddPlayerSyncDB(playerid int64, sync *Syncdb) error

AddPlayerSyncDB 添加db同步信息

func AddRequestNum

func AddRequestNum(playerid int64, ttl int64, num int32) error

AddRequestNum 增加请求次数

func CheckRedisConnect

func CheckRedisConnect() bool

CheckRedisConnect 测试连接redis

func ClearOnline

func ClearOnline()

ClearOnline 清除在线表

func Connect added in v0.0.6

func Connect(host string, port int, database int) error

func DelPlayerSyncDB

func DelPlayerSyncDB(playerid int64) error

DelPlayerSyncDB 删除db同步信息

func GetAllOnlinePlayer

func GetAllOnlinePlayer() map[int64]bool

获得全部在线用户

func GetAllPlayerIds

func GetAllPlayerIds() []int64

GetAllPlayerIds 获取全服玩家id

func GetNeedSyncPlayer

func GetNeedSyncPlayer() []int64

GetNeedSyncPlayer 获取需同步db的用户

func GetOnline

func GetOnline(playerid int64) bool

GetOnline 获取在线状态

func GetOnlineCount

func GetOnlineCount() int

获得在线数量

func GetOnlinePlayersWithCount

func GetOnlinePlayersWithCount(count int32) []int64

GetOnlinePlayersWithCount 获得指定数目的在线用户

func GetPlayersOnline

func GetPlayersOnline(playerids []int64) (onlines map[int64]bool)

GetPlayersOnline 批量获取用户在线状态

func GetRedisPool

func GetRedisPool() *redis.Pool

GetRedisPool 获得redis连接对象池

func GetRequestNum

func GetRequestNum(playerid int64) int32

GetRequestNum 获取请求次数

func IsInBlackList

func IsInBlackList(playerid int64) bool

IsInBlackList 是否在黑名单

func ReadConfig

func ReadConfig(key string) string

func ReadNginxAddrs

func ReadNginxAddrs() ([]string, error)

ReadNginxAddrs 读取nginx地址

func RemoveNginxAddr

func RemoveNginxAddr(addr string) error

RemoveNginxAddr 删除nginx地址

func RemoveServerInfo

func RemoveServerInfo(name string, id string) error

RemoveServerInfo 删除服务器信息

func SetOffline

func SetOffline(playerid int64)

SetOffline 设置不在线

func SetOnline

func SetOnline(playerid int64)

SetOnline 设置在线

func Startup

func Startup(server string, database int) bool

Startup 启动 正常情况下不需要调用

func Test

func Test()

Test ..

func WriteConfig

func WriteConfig(key string, config string) error

func WriteNginxAddr

func WriteNginxAddr(addr string) error

WriteNginxAddr 写nginx地址

func WriteNginxAddrs

func WriteNginxAddrs(addrs []string) error

func WriteServerInfo

func WriteServerInfo(server *Server) error

WriteServerInfo 写服务器信息

Types

type HashCache

type HashCache struct {
	// contains filtered or unexported fields
}

HashCache 哈希表缓存

func NewHashCache

func NewHashCache(name string) *HashCache

NewHashCache 创建哈希表缓存对象

func (*HashCache) Exists

func (h *HashCache) Exists(keys ...interface{}) map[interface{}]bool

Exists 是否存在

func (*HashCache) Load

func (h *HashCache) Load(keys ...interface{}) (map[interface{}][]byte, error)

Load 加载数据

func (*HashCache) Remove

func (h *HashCache) Remove(ids []int64) error

Remove 删除数据

func (*HashCache) Save

func (h *HashCache) Save(data map[interface{}][]byte) error

Save 保存数据

type Server

type Server struct {
	ID      string `json:"ID"`      //ID
	Version string `json:"Version"` //版本
	Addr    string `json:"Addr"`    //地址
	Name    string `json:"Name"`    //服务器名称
}

Server 服务器信息

func ReadServerInfo

func ReadServerInfo(name string, id string) *Server

ReadServerInfo 读取服务器信息

type Statistics

type Statistics struct {
	// contains filtered or unexported fields
}

统计对象

func NewStatistics

func NewStatistics() *Statistics

NewStatistics 创建统计对象

func (*Statistics) ExpireResetData

func (s *Statistics) ExpireResetData()

ExpireResetData 过期重置数据

func (*Statistics) Save

func (s *Statistics) Save() error

Save 保存数据

type Syncdb

type Syncdb struct {
	PlayerID int64 `json:"playerid"`
	Player   bool  `json:"player"`
	Hero     bool  `json:"hero"`
	Props    bool  `json:"props"`
	Friend   bool  `json:"friend"`
}

func GetPlayerSyncDB

func GetPlayerSyncDB(playerid int64) *Syncdb

GetPlayerSyncDB 获取db同步信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL