zredis

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPool

func NewPool(option ...Option) *redis.Pool

Types

type Option

type Option func(*RedisConfig)

Option is a RedisConfig configurator to be supplied to NewRedisConfig() function.

func WithConnectTimeout

func WithConnectTimeout(connecttimeout time.Duration) Option

WithConnectTimeout sets the ConnectTimeout

func WithDb

func WithDb(db int) Option

WithDb sets the Db

func WithDial

func WithDial(f func() (redis.Conn, error)) Option

WithDial sets the Dial

func WithHost

func WithHost(host string) Option

WithHost sets the Host

func WithIdleTimeout

func WithIdleTimeout(idletimeout time.Duration) Option

WithIdleTimeout sets the IdleTimeout

func WithMaxActive

func WithMaxActive(maxactive int) Option

WithMaxActive sets the MaxActive

func WithMaxConnLifetime

func WithMaxConnLifetime(maxconnlifetime time.Duration) Option

WithMaxConnLifetime sets the MaxConnLifetime

func WithMaxIdle

func WithMaxIdle(maxidle int) Option

WithMaxIdle sets the MaxIdle

func WithPass

func WithPass(pass string) Option

WithPass sets the Pass

func WithPort

func WithPort(port int) Option

WithPort sets the Port

func WithReadTimeout

func WithReadTimeout(timeout time.Duration) Option

WithReadTimeout sets the ReadTimeout

func WithTestOnBorrow

func WithTestOnBorrow(f func(c redis.Conn, t time.Time) error) Option

WithTestOnBorrow sets the TestOnBorrow

func WithWait

func WithWait(wait bool) Option

WithWait sets the Wait

func WithWriteTimeout

func WithWriteTimeout(timeout time.Duration) Option

WithWriteTimeout sets the WriteTimeout

type RedisConfig

type RedisConfig struct {
	Dial            func() (redis.Conn, error)
	TestOnBorrow    func(c redis.Conn, t time.Time) error
	MaxIdle         int
	MaxActive       int
	IdleTimeout     time.Duration
	Wait            bool
	MaxConnLifetime time.Duration
	Host            string
	Port            int
	ConnectTimeout  time.Duration
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	Pass            string
	Db              int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL