-
Notifications
You must be signed in to change notification settings - Fork 1
/
interface.go
73 lines (69 loc) · 1.68 KB
/
interface.go
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package red
import (
"context"
)
// Connecter RESP
type Connecter interface {
DoStringReply(ctx context.Context, args []string) (reply string, isNil bool, err error)
DoStringReplyWithoutNil(ctx context.Context, args []string) (reply string, err error)
DoIntegerReply(ctx context.Context, args []string) (reply int64, isNil bool, err error)
DoIntegerReplyWithoutNil(ctx context.Context, args []string) (reply int64, err error)
DoArrayIntegerReply(ctx context.Context, args []string) (reply []OptionInt64, err error)
DoArrayStringReply(ctx context.Context, args []string) (reply []OptionString, err error)
Eval(ctx context.Context, script Script) (reply Reply, isNil bool, err error)
EvalWithoutNil(ctx context.Context, script Script) (reply Reply, err error)
}
type API struct {
// strings
Append APPEND
BitCount BITCOUNT
BitField BITFIELD
BitOp BITOP
BitPos BITPOS
Decr DECR
DecrBy DECRBY
Get GET
GetBit GETBIT
GetDel GETDEL
GetEx GETEX
GetRange GETRANGE
// GETSET: Please use SET (GETSET有清空TTL的"隐患")
Incr INCR
IncrBy INCRBY
IncrByFloat INCRBYFLOAT
MGet MGET
MSet MSET
MSetNX MSETNX
// PSETEX: Please use SET
Set SET
SetBit SETBIT
SetRange SETRANGE
// STRALGO TODO
StrLen STRLEN
// keys
Copy COPY
Del DEL
Unlink UNLINK
Dump DUMP
Exists EXISTS
Expire EXPIRE
ExpireAt EXPIREAT // @needtest
ExpireTime EXPIRETIME // @needtest
Keys KEYS
PExpire PEXPIRE
// PEXPIREAT
// PEXPIRETIME
PTTL PTTL
// RENAME
// RENAMENX
// RESTORE
// SORT
// SORT_RO
// TOUCH
// TTL
// TYPE
// UNLINK
// WAIT
// SCAN
HDEL HDEL
}