引入数据库,代码,配置文件三位一体内容,准备进行一体化配置

This commit is contained in:
2021-06-03 05:31:09 +08:00
parent 9af232840c
commit 99933e02f4
9 changed files with 166 additions and 10 deletions
+5 -3
View File
@@ -180,8 +180,8 @@ func (that *Application) SetCache() {
cacheIns := HoTimeCache{}
cacheIns.Init(that.Config.GetMap("cache"), HoTimeDBInterface(&that.Db), &that.Error)
that.HoTimeCache = &cacheIns
//debug模式开启的时候关闭数据库缓存,防止调试出问题
if that.Config.GetInt("debug") == 0 {
//mode生产模式开启的时候才开启数据库缓存,防止调试出问题
if that.Config.GetInt("mode") == 0 {
that.Db.HoTimeCache = &cacheIns
}
}
@@ -382,8 +382,10 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
//设置header
delete(header, "Content-Type")
if that.Config.GetInt("debug") != 1 {
if that.Config.GetInt("mode") == 0 {
header.Set("Cache-Control", "public")
} else {
header.Set("Cache-Control", "no-cache")
}
if strings.Index(path, ".m3u8") != -1 {