引入数据库,代码,配置文件三位一体内容,准备进行一体化配置
This commit is contained in:
+5
-3
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user