From 18a2aeadaaaec522bdbc001a9e60c3f3d5bacb4e Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 5 Aug 2020 23:22:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=9A=E4=B9=89=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=92=8C=E9=98=9F=E5=88=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cache/type.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pkg/cache/type.go diff --git a/pkg/cache/type.go b/pkg/cache/type.go new file mode 100644 index 00000000..5327760e --- /dev/null +++ b/pkg/cache/type.go @@ -0,0 +1,24 @@ +package cache + +import ( + "time" +) + +type Adapter interface { + Connect() + Get(key string) (string, error) + Set(key string, val interface{}, expire int) error + Del(key string) error + HashGet(hk, key string) (string, error) + HashDel(hk, key string) error + Increase(key string) error + Expire(key string, dur time.Duration) error + SetQueue(name string, message Message) error + GetQueue(name string, f func(message Message) error) +} + +type Message struct { + ID string + Stream string + Values map[string]interface{} +} From b9d30eee88e14b3d7fcf68b608cc4ec36608ad40 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 5 Aug 2020 23:30:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=9A=E4=B9=89=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=92=8C=E9=98=9F=E5=88=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cache/type.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cache/type.go b/pkg/cache/type.go index 5327760e..e5844c9f 100644 --- a/pkg/cache/type.go +++ b/pkg/cache/type.go @@ -17,8 +17,8 @@ type Adapter interface { GetQueue(name string, f func(message Message) error) } -type Message struct { - ID string - Stream string - Values map[string]interface{} +type Message interface { + SetID(string) + SetStream(string) + SetValue(map[string]interface{}) } From b57af6c5423af1cda0f9daf8dcb28c033bf0142d Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 5 Aug 2020 23:31:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AE=9A=E4=B9=89=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=92=8C=E9=98=9F=E5=88=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cache/type.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/cache/type.go b/pkg/cache/type.go index e5844c9f..e10941d7 100644 --- a/pkg/cache/type.go +++ b/pkg/cache/type.go @@ -21,4 +21,7 @@ type Message interface { SetID(string) SetStream(string) SetValue(map[string]interface{}) + GetID() string + GetStream() string + GetValue() map[string]interface{} }