Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultRedisClientType is the default Redis Client Type DefaultRedisClientType = "standard" // DefaultRedisProtocol is the default Redis Client protocol DefaultRedisProtocol = "tcp" // DefaultRedisEndpoint is the default Redis Client endpoint DefaultRedisEndpoint = "redis:6379" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// ClientType defines the type of Redis Client ("standard", "cluster", "sentinel")
ClientType string `yaml:"client_type,omitempty"`
// Protocol represents the connection method (e.g., "tcp", "unix", etc.)
Protocol string `yaml:"protocol,omitempty"`
// Endpoint represents FQDN:port or IP:Port of the Redis Endpoint
Endpoint string `yaml:"endpoint,omitempty"`
// Endpoints represents FQDN:port or IP:Port collection of a Redis Cluster or Sentinel Nodes
Endpoints []string `yaml:"endpoints,omitempty"`
// Username can be set when using a password protected redis instance.
Username string `yaml:"username,omitempty"`
// Password can be set when using a password protected redis instance.
Password types.EnvString `yaml:"password,omitempty"`
// SentinelMaster should be set when using Redis Sentinel to indicate the Master Node
SentinelMaster string `yaml:"sentinel_master,omitempty"`
// DB is the Database to be selected after connecting to the server.
DB int `yaml:"db,omitempty"`
// MaxRetries is the maximum number of retries before giving up on the command
MaxRetries int `yaml:"max_retries,omitempty"`
// MinRetryBackoff is the minimum backoff between each retry.
MinRetryBackoff time.Duration `yaml:"min_retry_backoff,omitempty"`
// MaxRetryBackoff is the Maximum backoff between each retry.
MaxRetryBackoff time.Duration `yaml:"max_retry_backoff,omitempty"`
// DialTimeout is the timeout for establishing new connections.
DialTimeout time.Duration `yaml:"dial_timeout,omitempty"`
// ReadTimeout is the timeout for socket reads.
// If reached, commands will fail with a timeout instead of blocking.
ReadTimeout time.Duration `yaml:"read_timeout,omitempty"`
// WriteTimeout is the timeout for socket writes.
// If reached, commands will fail with a timeout instead of blocking.
WriteTimeout time.Duration `yaml:"write_timeout,omitempty"`
// PoolSize is the maximum number of socket connections.
PoolSize int `yaml:"pool_size,omitempty"`
// MinIdleConns is the minimum number of idle connections
// which is useful when establishing new connection is slow.
MinIdleConns int `yaml:"min_idle_conns,omitempty"`
// ConnMaxLifetime is the connection age at which client retires (closes) the connection.
ConnMaxLifetime time.Duration `yaml:"max_conn_age,omitempty"`
// PoolTimeout is the amount of time client waits for connection if all
// connections are busy before returning an error.
PoolTimeout time.Duration `yaml:"pool_timeout,omitempty"`
// ConnMaxIdleTime is the amount of time after which client closes idle connections.
ConnMaxIdleTime time.Duration `yaml:"idle_timeout,omitempty"`
// UseTLS indicates whether the server connection is TLS
UseTLS bool `yaml:"use_tls,omitempty"`
}
Options is a collection of Configurations for Connecting to Redis
Click to show internal directories.
Click to hide internal directories.