myredis

package
v0.0.0-...-cd1bf01 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCOUNT_ACCOUNTMAIN_KEY = "AccountMain:%s"
	ACCOUNT_USERIDMAIN_KEY  = "UserIDMain:%d" //关联账号名
	ACCOUNT_LOGIN_KEY       = "AccountLogin:%d"
	ACCOUNT_TOKEN_KEY       = "AccountToken:%d" //AccountToken:userid
	ACCOUNT_THIRDINFO_KEY   = "AccountThirdInfo:%d"
	ACCOUNT_SECURITY_KEY    = "AccountSecurity:%d"
)
View Source
const (
	REDIS_TOKEN_TTF   = 60 * 30 * time.Second       //token有效期30min
	REDIS_ACCOUNT_TTF = 3600 * 24 * 7 * time.Second //账号属性有效期7day
)
View Source
const (
	USER_CURRENCY_KEY     = "UserCurrency:%d"    //UserCurrency:userid 货币
	USER_BACKPACK_SET_KEY = "UserBackPack:%d"    //UserBackPack:userid 所有道具ID集合
	USER_PROPERTY_KEY     = "UserProperty:%d"    //UserProperty:userid 用户平台属性
	USER_DAYPROPERTY_KEY  = "UserDayProperty:%d" //UserDayProperty:userid 用户每日平台属性
	USER_ONLINE_KEY       = "UserOnline:%d"      //UserOnline:userid 用户在线
	USER_ADINFO_KEY       = "UserAdInfo:%d"
	USER_SAFECTRL_KEY     = "UserSafeCtrl:%d" //用户风控属性
	USER_TASK_KEY         = "UserTask:%d"     //用户任务
)
View Source
const (
	GAMEDATA_KEY = "GameData:%d:%d"
)

Variables

This section is empty.

Functions

func CheckUserRedisValid

func CheckUserRedisValid(redisName string, userID int64) bool

func DeleteOnline

func DeleteOnline(redisName string, userid int64)

func FixTimePropDeadLine

func FixTimePropDeadLine(redisName string, userID int64, propList []msg.UserPropChange)

func GetOnlineInfo

func GetOnlineInfo(redisName string, userid int64) (model.GameUserOnline, error)

func GetRedis

func GetRedis(dbName string, userID int64) (*redis.Client, error)

func GetUserThirdInfo

func GetUserThirdInfo(redisName string, userID int64) ([]interface{}, error)

func OpenRedis

func OpenRedis(dbinfo conf.RedisInfo) (dbconn *redis.Client, err error)

func OpenRedisGroup

func OpenRedisGroup(dbinfo conf.RedisInfo) error

func SaveGameData

func SaveGameData(redisName string, data msg.Accountwdatareq) error

func SaveGameRoundProperty

func SaveGameRoundProperty(redisName string, data msg.Accountwdatareq) error

func SaveSafeCtrl

func SaveSafeCtrl(redisName string, safeCtrl msg.GameUserSafeCtrl)

func SaveSecurityInfo

func SaveSecurityInfo(redisName string, asinfo model.AccountSecurityInfo)

func SaveThirdPartInfo

func SaveThirdPartInfo(redisName string, atinfo model.AccountThirdpartInfo)

func SaveUserDayTask

func SaveUserDayTask(redisName string, userTask model.GameUserTask) error

func SaveUserPropList

func SaveUserPropList(redisName string, userID int64, propList []msg.UserPropChange)

func SaveUserProperty

func SaveUserProperty(redisName string, data msg.Accountwdatareq) error

func SelectAccount

func SelectAccount(redisName string, datareq *msg.Accountrdatareq) ([]interface{}, error)

func SelectGameData

func SelectGameData(redisName string, datareq *msg.Accountrdatareq) ([]interface{}, error)

func SelectSafeCtrl

func SelectSafeCtrl(redisName string, userid int64) (msg.GameUserSafeCtrl, error)

func SelectUserAdInfo

func SelectUserAdInfo(redisName string, userid int64) ([]interface{}, error)

func SelectUserDayProperty

func SelectUserDayProperty(redisName string, userid int64) ([]interface{}, error)

func SelectUserInfo

func SelectUserInfo(redisName string, datareq *msg.Accountrdatareq) ([]interface{}, error)

func StartRedis

func StartRedis()

func UpdateRedisTTF

func UpdateRedisTTF(redisName string, userID int64, key []string, ttfs []time.Duration)

func WriteAccountInfo

func WriteAccountInfo(redisName string, token model.AccountTokenInfo, aInfo model.AccountMainInfo,
	aThirdInfo model.AccountThirdpartInfo, aSecurityInfo model.AccountSecurityInfo, aLoginInfo model.AccountLastloginInfo)

func WriteAccountToken

func WriteAccountToken(redisName string, token model.AccountTokenInfo, aLoginInfo model.AccountLastloginInfo)

func WriteGameData2Redis

func WriteGameData2Redis(redisName string, gamedata model.GameDataRecord)

func WritePropList

func WritePropList(redisName string, userID int64, propList []model.GameUserBackpack)

func WriteUserAdInfo

func WriteUserAdInfo(redisName string, useradinfo model.GameUserAdInfo) error

func WriteUserCurrency

func WriteUserCurrency(redisName string, userProperty model.GameUserCurrency)

func WriteUserDayProperty

func WriteUserDayProperty(redisName string, userProperty model.GameUserDayProperty)

func WriteUserInfoRedis

func WriteUserInfoRedis(redisName string, userProperty model.GameUserProperty, userDayProperty model.GameUserDayProperty,
	userCurrency model.GameUserCurrency, propList []model.GameUserBackpack, userOnline model.GameUserOnline,
	userSafeCtrl msg.GameUserSafeCtrl, userTask model.GameUserTask)

WriteUserInfoRedis 首次登陆,信息写入redis

func WriteUserOnline

func WriteUserOnline(redisName string, userProperty model.GameUserOnline)

func WriteUserProperty

func WriteUserProperty(redisName string, userProperty model.GameUserProperty)

Types

type RedisShareding

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

Jump to

Keyboard shortcuts

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