工具
This commit is contained in:
+7
-8
@@ -5,8 +5,9 @@ import (
|
||||
"fmt"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"go.hoteas.com/hotime"
|
||||
"go.hoteas.com/hotime/cache"
|
||||
//"go.hoteas.com/hotime/cache"
|
||||
"golang.org/x/net/websocket"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -32,14 +33,8 @@ 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:=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"
|
||||
@@ -81,7 +76,11 @@ func main() {
|
||||
for true {
|
||||
msg := make([]byte, 5120)
|
||||
n, err := ws.Read(msg)
|
||||
go func() {
|
||||
time.Sleep(time.Second*5)
|
||||
ws.Write([]byte("dsadasdasgregergrerge"))
|
||||
|
||||
}()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user