registry.go
478 Bytes
package configs
import (
"apigame/common/svmysql"
"apigame/common/svredis"
"fmt"
)
// GetApiGame 获取 api游戏配置
func GetApiGame(gameId string) (conf *ApiGameConfig, err error) {
conf = new(ApiGameConfig)
has := svredis.LoadData(gameId, conf)
if has {
fmt.Println("dwjw GetApiGame use cache")
return
}
has, err = svmysql.First(conf, gameId)
if err != nil {
return
}
fmt.Println("dwjw GetApiGame save cache")
svredis.SaveData(gameId, conf)
return
}