定义缓存和队列接口
This commit is contained in:
1 parent
980d0977fc
commit
18a2aeadaa
1 file changed
+24
Vendored
+24
@@ -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{}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user