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] =?UTF-8?q?=E5=AE=9A=E4=B9=89=E7=BC=93=E5=AD=98=E5=92=8C?= =?UTF-8?q?=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{} +}