From 911e6eb6a1a1ab5dd979a1917b79a5465da88181 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期三, 18 十一月 2020 14:33:28 +0800 Subject: [PATCH] 修改gitignore --- store_test.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/store_test.go b/store_test.go new file mode 100644 index 0000000..f1ba8f5 --- /dev/null +++ b/store_test.go @@ -0,0 +1,38 @@ +package boltcache + +import ( + "strconv" + "testing" + "time" +) + +func TestInit(t *testing.T) { + conf := NewDefaultConfig() + ls, err := Init(conf) + if err != nil { + ls.printLog("Init err:", err) + return + } + + defer ls.Close() + + go consume(ls) + + for i:=0; i<10000; i++{ + ls.ApplyLog([]byte("hello world "+strconv.Itoa(i))) + time.Sleep(time.Second * 1) + } + +} + +func consume(ls *LogStore) { + for { + lc := ls.Get() + if lc != nil { + ls.printLog(lc.conf.BucketName," send old log:", string(lc.Log.Data)) + ls.Delete(lc) + } + + time.Sleep(10 * time.Second) + } +} \ No newline at end of file -- Gitblit v1.8.0