Documentation ¶
Index ¶
- Variables
- type BreakerFunc
- type Client
- type ConfigFunc
- func WithBorrowTimeout(timeout time.Duration) ConfigFunc
- func WithBreaker(breaker overcurrent.CircuitBreaker) ConfigFunc
- func WithBreakerRegistry(registry overcurrent.Registry, name string) ConfigFunc
- func WithConnectTimeout(timeout time.Duration) ConfigFunc
- func WithDatabase(database int) ConfigFunc
- func WithDialerFactory(dialerFactory DialerFactory) ConfigFunc
- func WithLogger(logger Logger) ConfigFunc
- func WithPassword(password string) ConfigFunc
- func WithPoolCapacity(capacity int) ConfigFunc
- func WithReadReplicaAddrs(addrs ...string) ConfigFunc
- func WithReadTimeout(timeout time.Duration) ConfigFunc
- func WithRetryBackoff(backoff backoff.Backoff) ConfigFunc
- func WithWriteTimeout(timeout time.Duration) ConfigFunc
- type Conn
- type DialFunc
- type DialerFactory
- type Logger
- type Pipeline
- type Pool
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoConnection is returned when the borrow timeout elapses. ErrNoConnection = errors.New("no connection available in pool") )
var NilLogger = NewNilLogger()
NilLogger is a singleton silent logger.
Functions ¶
This section is empty.
Types ¶
type BreakerFunc ¶
type BreakerFunc func(overcurrent.BreakerFunc) error
BreakerFunc bridges the interface between the Call function of an overcurrent breaker and an overcurrent registry.
type Client ¶
Client is a goroutine-safe, minimal, and pooled Redis client.
func NewClient ¶
func NewClient(addr string, configs ...ConfigFunc) Client
NewClient creates a new Client.
type ConfigFunc ¶
type ConfigFunc func(*clientConfig)
ConfigFunc is a function used to initialize a new client.
func WithBorrowTimeout ¶
func WithBorrowTimeout(timeout time.Duration) ConfigFunc
WithBorrowTimeout sets the maximum time
func WithBreaker ¶
func WithBreaker(breaker overcurrent.CircuitBreaker) ConfigFunc
WithBreaker sets the circuit breaker instance to use around new connections. The default uses a no-op circuit breaker.
func WithBreakerRegistry ¶
func WithBreakerRegistry(registry overcurrent.Registry, name string) ConfigFunc
WithBreakerRegistry sets the overcurrent registry to use and the name of the circuit breaker config tu use around new connections. The default uses a no-op circuit breaker.
func WithConnectTimeout ¶
func WithConnectTimeout(timeout time.Duration) ConfigFunc
WithConnectTimeout sets the connect timeout for new connections (default is 5 seconds).
func WithDatabase ¶
func WithDatabase(database int) ConfigFunc
WithDatabase sets the database index (default is 0).
func WithDialerFactory ¶
func WithDialerFactory(dialerFactory DialerFactory) ConfigFunc
WithDialerFactory sets the dialer factory to use to create the connection pools. Each factory creates connections to a single unique address.
func WithLogger ¶
func WithLogger(logger Logger) ConfigFunc
WithLogger sets the logger instance (the default will use Go's builtin logging library).
func WithPassword ¶
func WithPassword(password string) ConfigFunc
WithPassword sets the password (default is "").
func WithPoolCapacity ¶
func WithPoolCapacity(capacity int) ConfigFunc
WithPoolCapacity sets the maximum number of concurrent connections that can be in use at once (default is 10).
func WithReadReplicaAddrs ¶
func WithReadReplicaAddrs(addrs ...string) ConfigFunc
WithReadReplicaAddrs sets the addresses of the client returned by client's the ReadReplica() method.
func WithReadTimeout ¶
func WithReadTimeout(timeout time.Duration) ConfigFunc
WithReadTimeout sets the read timeout for all connections in the pool (default is 5 seconds).
func WithRetryBackoff ¶
func WithRetryBackoff(backoff backoff.Backoff) ConfigFunc
WithRetryBackoff sets the circuit backoff prototype to use when retrying a redis command after a non-protocol network error.
func WithWriteTimeout ¶
func WithWriteTimeout(timeout time.Duration) ConfigFunc
WithWriteTimeout sets the write timeout for all connections in the pool (default is 5 seconds).
type DialerFactory ¶
DialerFactory creates a DialFunc for the given address.
type Logger ¶
Logger is an interface to the logger the client writes to.
func NewPrintLogger ¶
func NewPrintLogger() Logger
NewPrintLogger creates a logger that prints to stdout.