整个包结构重构
This commit is contained in:
+9
-6
@@ -2,8 +2,11 @@ package main
|
||||
|
||||
import (
|
||||
"../../hotime"
|
||||
"../../hotime/cache"
|
||||
"../../hotime/common"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
//"go.hoteas.com/hotime/cache"
|
||||
"golang.org/x/net/websocket"
|
||||
"time"
|
||||
@@ -24,7 +27,7 @@ func main() {
|
||||
//手动模式,
|
||||
appIns.SetConfig("example/config/config.json")
|
||||
//redis缓存接入
|
||||
//ca:=hotime.CacheIns(&hotime.CacheRedis{Host:appIns.Config.GetString("redisHost"),Pwd:appIns.Config.GetString("redisPwd"),Time:appIns.Config.GetCeilInt64("cacheLongTime")})
|
||||
//ca:=cache.CacheIns(&cache.CacheRedis{Host:appIns.Config.GetString("redisHost"),Pwd:appIns.Config.GetString("redisPwd"),Time:appIns.Config.GetCeilInt64("cacheLongTime")})
|
||||
//ca.Cache("xyzm","dasdas")
|
||||
//ca.Cache("xyzn","dasdas")
|
||||
//ca.Cache("xyzo","dasdas")
|
||||
@@ -33,12 +36,12 @@ func main() {
|
||||
//mysql
|
||||
//mysql.SetDB(&appIns)
|
||||
//自动选择数据库
|
||||
|
||||
appIns.SetSession(hotime.CacheIns(&hotime.CacheMemory{}), hotime.CacheIns(&hotime.CacheDb{Db: &appIns.Db, Time: appIns.Config.GetInt64("cacheTime")}))
|
||||
appIns.SetCache(hotime.CacheIns(&hotime.CacheMemory{}))
|
||||
dbInterface := cache.HoTimeDBInterface(&appIns.Db)
|
||||
appIns.SetSession(cache.CacheIns(&cache.CacheMemory{}), cache.CacheIns(&cache.CacheDb{Db: dbInterface, Time: appIns.Config.GetInt64("cacheTime")}))
|
||||
//appIns.SetCache(cache.CacheIns(&cache.CacheMemory{}))
|
||||
|
||||
//快捷模式
|
||||
appIns.SetDefault(func(err ...*hotime.Error) (*sql.DB, *sql.DB) {
|
||||
appIns.SetDefault(func(err ...*common.Error) (*sql.DB, *sql.DB) {
|
||||
query := appIns.Config.GetString("dbUser") + ":" + appIns.Config.GetString("dbPwd") +
|
||||
"@tcp(" + appIns.Config.GetString("dbHost") + ":" + appIns.Config.GetString("dbPort") + ")/" + appIns.Config.GetString("dbName") + "?charset=utf8"
|
||||
DB, e := sql.Open("mysql", query)
|
||||
@@ -59,7 +62,7 @@ func main() {
|
||||
//
|
||||
// return true
|
||||
//})
|
||||
hotime.LogError("dasdasdasdasdas")
|
||||
//hotime.LogError("dasdasdasdasdas")
|
||||
this.Display(5, "dsadas")
|
||||
},
|
||||
"websocket": func(this *hotime.Context) {
|
||||
|
||||
Reference in New Issue
Block a user