pool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRedisPoolSize defines max free connection in pool
	DefaultRedisPoolSize = 8
)

Variables

This section is empty.

Functions

func Check

func Check(configuration Configuration) func(redis.Conn, time.Time) error

func CheckFrequency

func CheckFrequency(prefix string) time.Duration

CheckFrequency returns connection check timeout

func IdleTimeout

func IdleTimeout(prefix string) time.Duration

IdleTimeout returns connection idle timeout

func MaxActiveCount

func MaxActiveCount(prefix string) int

MaxActiveCount returns max active connections count

func MaxIdleCount

func MaxIdleCount(prefix string) int

MaxIdleCount returns max idle connections count

func New

func New(config Configuration,
	dial func() (redis.Conn, error),
	check func(redis.Conn, time.Time) error,
) *redis.Pool

New creates new Redis connection pool

Types

type Configuration

type Configuration struct {
	WaitConnection           bool          // Ожидание свободного подключения при достижении ActivePoolSize
	MaxIdleConnectionCount   int           // Количество соеднинений в режиме ожидания. Если 0, то в пулле не сохраняется соединение
	MaxActiveConnectionCount int           // Максимальное количество соединений. Если 0, то неограниченно
	IdleConnectionTimeout    time.Duration // Время хранения соединения в пулле
	CheckConnectionFrequency time.Duration // Таймаут проверки доступности редиса
}

Configuration структура настроек пулла соединений к редису

func ENV

func ENV(prefix string) Configuration

ENV returns redis pool configuration from env variables

Jump to

Keyboard shortcuts

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