Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionParam ¶
type ConnectionParam struct { // Host:port Address string // Optional password. Defaults to no authentication. Password string // Policy to use for reconnections (defaults to // LogReconnectPolicy with a base of 10 and factor of 1 ms) Policy ReconnectPolicy // Dial timeout for redis (defaults to no timeout) Timeout time.Duration }
Used to denote the parameters of the redis connection.
type LogReconnectPolicy ¶
type LogReconnectPolicy struct { // Base for the logarithim Base float64 // Duration multiplier for the calculated value. Factor time.Duration // contains filtered or unexported fields }
Reconnect policy which increases the reconnect day in a logarithmic fashion. The equation used is delay = log(tries) / log(base) * Factor
func (*LogReconnectPolicy) Next ¶
func (l *LogReconnectPolicy) Next() time.Duration
func (*LogReconnectPolicy) Reset ¶
func (l *LogReconnectPolicy) Reset()
type ReconnectPolicy ¶
type ReconnectPolicy interface { // Gets the next reconnect time, usually incrementing some // counter so the next attempt is longer. Next() time.Duration // Resets the number of attempts. Reset() }
The ReconnectPolicy defines the pattern of delay times used after a connection is lost before waiting to reconnection.
func New ¶
func New(param ConnectionParam, maxIdle int) (*redis.Pool, ReconnectPolicy)
New makes and returns a pointer to a new Connector instance. It sets some defaults on the ConnectionParam object, such as the policy, which defaults to a LogReconnectPolicy with a base of 10ms. A call to this function does not produce a connection.
type StaticReconnectPolicy ¶
Reconnect policy which waits a set period of time on each connect.
func (*StaticReconnectPolicy) Next ¶
func (s *StaticReconnectPolicy) Next() time.Duration
func (*StaticReconnectPolicy) Reset ¶
func (r *StaticReconnectPolicy) Reset()