Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.9.0
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CmdOnMaster ¶ added in v0.9.0
func (*Client) CmdOnSlave ¶ added in v0.9.0
type ClusterClient ¶ added in v0.11.12
type ClusterClient struct {
redis.ClusterClient
}
type ClusterOptions ¶ added in v0.11.12
type ClusterOptions struct {
Config
}
ClusterOptions 集群配置信息
func ClusterConfig ¶ added in v0.11.12
func ClusterConfig(name string) *ClusterOptions
ClusterConfig 集群模式
func DefaultClusterOption ¶ added in v0.11.12
func DefaultClusterOption() *ClusterOptions
DefaultClusterOption default option ...
func RawClusterConfig ¶ added in v0.11.12
func RawClusterConfig(key string) *ClusterOptions
func (*ClusterOptions) BuildCluster ¶ added in v0.11.12
func (config *ClusterOptions) BuildCluster() (*ClusterClient, error)
BuildCluster ..
func (*ClusterOptions) ClusterSingleton ¶ added in v0.11.12
func (config *ClusterOptions) ClusterSingleton() (*ClusterClient, error)
ClusterSingleton returns a singleton client conn.
func (*ClusterOptions) MustClusterBuild ¶ added in v0.11.12
func (config *ClusterOptions) MustClusterBuild() *ClusterClient
MustClusterBuild panics when error found.
func (*ClusterOptions) MustClusterSingleton ¶ added in v0.11.12
func (config *ClusterOptions) MustClusterSingleton() *ClusterClient
MustClusterSingleton panics when error found.
type Config ¶
type Config struct {
// Master host:port addresses of Master node
Master struct {
Addr string `json:"addr" toml:"addr"`
} `json:"master" toml:"master"`
// Slaves A list of host:port addresses of Slave nodes.
Slaves struct {
Addr []string `json:"addr" toml:"addr"`
} `json:"slaves" toml:"slaves"`
Addr []string `json:"addr" toml:"addr"`
Username string `json:"username" toml:"username"`
Password string `json:"password" toml:"password"`
/****** for github.com/go-redis/redis/v8 ******/
// DB default 0,not recommend
DB int `json:"db" toml:"db"`
// PoolSize applies per Stub node and not for the whole Stub.
PoolSize int `json:"poolSize" toml:"poolSize"`
// Maximum number of retries before giving up.
// Default is 3 retries; -1 (not 0) disables retries.
MaxRetries int `json:"maxRetries" toml:"maxRetries"`
// Minimum number of idle connections which is useful when establishing
// new connection is slow.
MinIdleConns int `json:"minIdleConns" toml:"minIdleConns"`
// Dial timeout for establishing new connections.
// Default is 5 seconds.
DialTimeout time.Duration `json:"dialTimeout" toml:"dialTimeout"`
// Timeout for socket reads. If reached, commands will fail
// with a timeout instead of blocking. Use value 0 for no timeout and 0 for default.
// Default is 3 seconds.
ReadTimeout time.Duration `json:"readTimeout" toml:"readTimeout"`
// Timeout for socket writes. If reached, commands will fail
// with a timeout instead of blocking.
// Default is ReadTimeout.
WriteTimeout time.Duration `json:"writeTimeout" toml:"writeTimeout"`
// Amount of time after which client closes idle connections.
// Should be less than server's timeout.
// Default is 5 minutes. -1 disables idle timeout check.
IdleTimeout time.Duration `json:"idleTimeout" toml:"idleTimeout"`
/****** for jupiter ******/
ReadOnMaster bool `json:"readOnMaster" toml:"readOnMaster"`
// nice option
Debug bool `json:"debug" toml:"debug"`
// a require will be recorded if cost bigger than this
SlowLogThreshold time.Duration `json:"slowThreshold" toml:"slowThreshold"`
// EnableMetric .. default true
EnableMetricInterceptor bool `json:"enableMetric" toml:"enableMetric"`
// EnableTrace .. default true
EnableTraceInterceptor bool `json:"enableTrace" toml:"enableTrace"`
// EnableAccessLog .. default false
EnableAccessLogInterceptor bool `json:"enableAccessLog" toml:"enableAccessLog"`
// EnableSentinel .. default true
EnableSentinel bool `json:"enableSentinel" toml:"enableSentinel"`
// OnDialError panic|error
OnDialError string `json:"level"`
// contains filtered or unexported fields
}
Config ...
func (*Config) MustSingleton ¶ added in v0.9.0
MustSingleton panics when error found.
Click to show internal directories.
Click to hide internal directories.