forked from free-lancers/electricity_bill_calc_service
enhacne(setting):增加缓存生命期配置。
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//服务器配置
|
||||
// 服务器配置
|
||||
type ServerSetting struct {
|
||||
RunMode string
|
||||
HttpPort int
|
||||
@@ -12,7 +12,7 @@ type ServerSetting struct {
|
||||
WriteTimeout time.Duration
|
||||
}
|
||||
|
||||
//数据库配置
|
||||
// 数据库配置
|
||||
type DatabaseSetting struct {
|
||||
User string
|
||||
Pass string
|
||||
@@ -31,9 +31,11 @@ type RedisSetting struct {
|
||||
|
||||
type ServiceSetting struct {
|
||||
MaxSessionLife time.Duration
|
||||
ItemsPageSize uint16
|
||||
CacheLifeTime time.Duration
|
||||
}
|
||||
|
||||
//定义全局变量
|
||||
// 定义全局变量
|
||||
var (
|
||||
ServerSettings *ServerSetting
|
||||
DatabaseSettings *DatabaseSetting
|
||||
@@ -41,7 +43,7 @@ var (
|
||||
ServiceSettings *ServiceSetting
|
||||
)
|
||||
|
||||
//读取配置到全局变量
|
||||
// 读取配置到全局变量
|
||||
func SetupSetting() error {
|
||||
s, err := NewConfigurationFile()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user