diff --git a/film/server/main.go b/film/server/main.go index ac6e3f0..c327652 100644 --- a/film/server/main.go +++ b/film/server/main.go @@ -5,11 +5,12 @@ import ( "server/plugin/db" "server/plugin/spider" "server/router" + "time" ) func init() { // 执行初始化前等待20s , 让mysql服务完成初始化指令 - //time.Sleep(time.Second * 20) + time.Sleep(time.Second * 20) //初始化redis客户端 err := db.InitRedisConn() if err != nil { @@ -23,7 +24,6 @@ func init() { } func main() { start() - //spider.MtSiteSpider() } func start() { diff --git a/film/server/model/Search.go b/film/server/model/Search.go index 7223bfb..660e65b 100644 --- a/film/server/model/Search.go +++ b/film/server/model/Search.go @@ -325,7 +325,7 @@ func GetMultiplePlay(siteName, key string) []MovieUrlInfo { // DataCache API请求 数据缓存 func DataCache(key string, data map[string]interface{}) { val, _ := json.Marshal(data) - db.Rdb.Set(db.Cxt, key, val, config.CategoryTreeExpired) + db.Rdb.Set(db.Cxt, key, val, time.Minute*30) } // GetCacheData 获取API接口的缓存数据 diff --git a/server/main.go b/server/main.go index ac6e3f0..c327652 100644 --- a/server/main.go +++ b/server/main.go @@ -5,11 +5,12 @@ import ( "server/plugin/db" "server/plugin/spider" "server/router" + "time" ) func init() { // 执行初始化前等待20s , 让mysql服务完成初始化指令 - //time.Sleep(time.Second * 20) + time.Sleep(time.Second * 20) //初始化redis客户端 err := db.InitRedisConn() if err != nil { @@ -23,7 +24,6 @@ func init() { } func main() { start() - //spider.MtSiteSpider() } func start() { diff --git a/server/model/Search.go b/server/model/Search.go index 7223bfb..660e65b 100644 --- a/server/model/Search.go +++ b/server/model/Search.go @@ -325,7 +325,7 @@ func GetMultiplePlay(siteName, key string) []MovieUrlInfo { // DataCache API请求 数据缓存 func DataCache(key string, data map[string]interface{}) { val, _ := json.Marshal(data) - db.Rdb.Set(db.Cxt, key, val, config.CategoryTreeExpired) + db.Rdb.Set(db.Cxt, key, val, time.Minute*30) } // GetCacheData 获取API接口的缓存数据