forked from wellle/rmq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredis_client.go
More file actions
32 lines (23 loc) · 773 Bytes
/
redis_client.go
File metadata and controls
32 lines (23 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package rmq
import (
"time"
"github.com/go-redis/redis"
)
type RedisClient interface {
GetClient() *redis.Client
// simple keys
Set(key string, value interface{}, expiration time.Duration) bool
Get(key string) (error, interface{})
Del(key string) (affected int, ok bool) // default affected: 0
TTL(key string) (ttl time.Duration, ok bool) // default ttl: 0
// lists
LLen(key string) (affected int, ok bool)
// sets
SAdd(key, value string) bool
SMembers(key string) (members []string) // default members: []string{}
SRem(key, value string) (affected int, ok bool) // default affected: 0
SCount(key string) (affected int, ok bool)
RunShaScript(shaScriptKey string, keys []string, args ...interface{}) *redis.Cmd
// special
FlushDb()
}