This commit is contained in:
+19
-2
@@ -5,13 +5,20 @@ import (
|
||||
"fmt"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"go.hoteas.com/hotime"
|
||||
"go.hoteas.com/hotime/cache"
|
||||
"golang.org/x/net/websocket"
|
||||
"github.com/garyburd/redigo/redis"
|
||||
)
|
||||
|
||||
func main() {
|
||||
hotime.CacheRedis{nil,redis.Dial()}
|
||||
|
||||
|
||||
|
||||
|
||||
appIns := hotime.Application{}
|
||||
|
||||
|
||||
|
||||
|
||||
i := 0
|
||||
|
||||
appIns.SetConnectListener(func(context *hotime.Context) bool {
|
||||
@@ -23,6 +30,16 @@ func main() {
|
||||
|
||||
//手动模式,
|
||||
appIns.SetConfig("example/config/config.json")
|
||||
|
||||
|
||||
ca:=hotime.CacheIns(&cache.CacheRedis{Host:appIns.Config.GetString("redisHost"),Pwd:appIns.Config.GetString("redisPwd"),Time:appIns.Config.GetCeilInt64("cacheLongTime")})
|
||||
|
||||
ca.Cache("x",hotime.Map{"1":"2132"})
|
||||
fmt.Println(ca.Cache("x").ToMap())
|
||||
fmt.Println(ca.Cache("x",nil).Data)
|
||||
fmt.Println(ca.Cache("x",nil).Data)
|
||||
fmt.Println(ca.Cache("x").Data)
|
||||
fmt.Println(ca.Cache("x").Data)
|
||||
appIns.SetConnectDB(func(err ...*hotime.Error) *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"
|
||||
|
||||
Reference in New Issue
Block a user