-
Notifications
You must be signed in to change notification settings - Fork 2
/
doc.go
46 lines (40 loc) · 989 Bytes
/
doc.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
/**
======== for redis driver ==============
options := &redis.UniversalOptions{
Addrs: []string{"127.0.0.1:6379"},
Password: "",
PoolSize: 10,
IdleTimeout: 300 * time.Second,
// Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
// conn, err := net.Dial(network, addr)
// if err == nil {
// go func() {
// time.Sleep(5 * time.Second)
// conn.Close()
// }()
// }
// return conn, err
// },
}
err := multi.InitDriver(&multi.Config{
DriverType: "redis",
TokenMaxCount: 10,
UniversalClient: redis.NewUniversalClient(options)})
if err != nil {
panic(err)
}
======== for local driver ==============
err := multi.InitDriver(&multi.Config{
DriverType: "local"
if err != nil {
panic(err)
}
======== for jwt driver ==============
err := multi.InitDriver(&multi.Config{
DriverType: "jwt",
HmacSecret: "your hmac_secret",
if err != nil {
panic(err)
}
*/
package multi