From 9dd7bb8196b8c03c19bc3f1fbfe8a1f93341fdfe Mon Sep 17 00:00:00 2001 From: 554325746@qq.com <554325746@qq.com> Date: 星期四, 11 七月 2019 10:06:30 +0800 Subject: [PATCH] fix cache --- dbpersoninfo.go | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) diff --git a/dbpersoninfo.go b/dbpersoninfo.go index 844b568..39d3f0b 100644 --- a/dbpersoninfo.go +++ b/dbpersoninfo.go @@ -9,6 +9,8 @@ "basic.com/pubsub/cache.git/esutil" "basic.com/pubsub/cache.git/shardmap" + "test/cache/esutil" + "test/cache/shardmap" "basic.com/valib/gosdk.git" ) @@ -64,14 +66,9 @@ fmt.Println() } -//func main(){ -// Init() -// Getdbpersonmsg("") -//} +func Getdbpersonmsg(tableid string, teststring []byte, IsCompare bool) (map[string]float32) { -func Getdbpersonmsg(tableid string, teststring []byte, IsCompare bool) ([]byte) { - - var buf []byte + totalmap := make(map[string]float32) if !IsCompare { return nil @@ -82,17 +79,21 @@ } if tableid == "" { - for _, val := range Cmap.cam{ - tmpbuf := val.Walk(Printest, teststring) - buf =append(buf, tmpbuf...) + for id, val := range Cmap.cam{ + fmt.Println("the id is: ", id) + tmpmap := val.Walk(Printest, teststring) + for key, sec := range tmpmap { + totalmap[key] = sec + } } - }else{ - for id, value := range Cmap.cam{ if id == tableid{ - fmt.Println(id) - buf =value.Walk(Printest, teststring) + fmt.Println("the id is: ", id) + tmpmap :=value.Walk(Printest, teststring) + for key, sec := range tmpmap { + totalmap[key]= sec + } break } } @@ -103,7 +104,7 @@ firsttime := time.Now() fmt.Println(time.Since(firsttime)) - return buf + return totalmap } func Printest(ci []byte, co string ) (float32){ -- Gitblit v1.8.0