-
Notifications
You must be signed in to change notification settings - Fork 3
/
noop.go
48 lines (36 loc) · 1.05 KB
/
noop.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
package redis
import (
"context"
"time"
"github.com/go-redis/redis/v8"
)
// NewNoopClient for redis.
func NewNoopClient() *NoopClient {
return &NoopClient{}
}
// NoopClient for redis.
type NoopClient struct{}
func (*NoopClient) Set(ctx context.Context, _ string, _ any, _ time.Duration) *redis.StatusCmd {
return redis.NewStatusCmd(ctx)
}
func (*NoopClient) SetXX(ctx context.Context, _ string, _ any, _ time.Duration) *redis.BoolCmd {
return redis.NewBoolCmd(ctx)
}
func (*NoopClient) SetNX(ctx context.Context, _ string, _ any, _ time.Duration) *redis.BoolCmd {
return redis.NewBoolCmd(ctx)
}
func (*NoopClient) Get(ctx context.Context, _ string) *redis.StringCmd {
return redis.NewStringCmd(ctx)
}
func (*NoopClient) Del(ctx context.Context, _ ...string) *redis.IntCmd {
return redis.NewIntCmd(ctx)
}
func (*NoopClient) Incr(ctx context.Context, _ string) *redis.IntCmd {
return redis.NewIntCmd(ctx)
}
func (*NoopClient) Ping(ctx context.Context) *redis.StatusCmd {
return redis.NewStatusCmd(ctx)
}
func (*NoopClient) Close() error {
return nil
}