/
redis_config.go
48 lines (37 loc) · 1.92 KB
/
redis_config.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 otredis
import (
"github.com/DoNewsCode/core/config"
)
// RedisUniversalOptions is the configuration options for redis.
type RedisUniversalOptions struct {
// Either a single address or a seed list of host:port addresses
// of cluster/sentinel nodes.
Addrs []string `json:"addrs" yaml:"addrs"`
// Database to be selected after connecting to the server.
// Only single-node and failover clients.
DB int `json:"db" yaml:"db"`
// Common options.
Username string `json:"username" yaml:"username"`
Password string `json:"password" yaml:"password"`
SentinelPassword string `json:"sentinelPassword" yaml:"sentinelPassword"`
MaxRetries int `json:"maxRetries" yaml:"maxRetries"`
MinRetryBackoff config.Duration `json:"minRetryBackoff" yaml:"minRetryBackoff"`
MaxRetryBackoff config.Duration `json:"maxRetryBackoff" yaml:"maxRetryBackoff"`
DialTimeout config.Duration `json:"dialTimeout" yaml:"dialTimeout"`
ReadTimeout config.Duration `json:"readTimeout" yaml:"readTimeout"`
WriteTimeout config.Duration `json:"writeTimeout" yaml:"writeTimeout"`
PoolSize int `json:"poolSize" yaml:"poolSize"`
MinIdleConns int `json:"minIdleConns" yaml:"minIdleConns"`
MaxConnAge config.Duration `json:"maxConnAge" yaml:"maxConnAge"`
PoolTimeout config.Duration `json:"poolTimeout" yaml:"poolTimeout"`
IdleTimeout config.Duration `json:"idleTimeout" yaml:"idleTimeout"`
IdleCheckFrequency config.Duration `json:"idleCheckFrequency" yaml:"idleCheckFrequency"`
// Only cluster clients.
MaxRedirects int `json:"maxRedirects" yaml:"maxRedirects"`
ReadOnly bool `json:"readOnly" yaml:"readOnly"`
RouteByLatency bool `json:"routeByLatency" yaml:"routeByLatency"`
RouteRandomly bool `json:"routeRandomly" yaml:"routeRandomly"`
// The sentinel master name.
// Only failover clients.
MasterName string `json:"masterName" yaml:"masterName"`
}