Documentation ¶
Overview ¶
Package redispool supports setting up redis connection pools parameterized via environment variables.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // URL is the redis URL the pool connects to, configured via `REDIS_URL`. URL string `env:"REDIS_URL,default=redis://127.0.0.1:6379"` // MaxIdleConns is the maximum number of idle connections in a pool, // configured via `REDIS_MAX_IDLE_CONNS`, defaults to 1. MaxIdleConns int `env:"REDIS_MAX_IDLE_CONNS,default=1"` // MaxActiveConns is the maximum number of active connections in a pool, // configured via `REDIS_MAX_ACTIVE_CONNS`, defaults to 50. MaxActiveConns int `env:"REDIS_MAX_ACTIVE_CONNS,default=50"` // MaxConnLifetime is the maximum lifetime of any connection in a pool, // configured via `REDIS_MAX_CONN_LIFETIME`, defaults to 0s. // Connections older than this duration will be closed. If the value is zero, // then the pool does not close connections based on age. MaxConnLifetime time.Duration `env:"REDIS_MAX_CONN_LIFETIME,default=0s"` // IdleTimeout is the duration how long connections can be idle before they're // closed, configured via `REDIS_IDLE_TIMEOUT`. When set to zero idle // connections won't be closed. Defaults to 0s. IdleTimeout time.Duration `env:"REDIS_IDLE_TIMEOUT,default=0s"` // IdleProbeInterval is the duration between the aliveness checks of idle // connections, configured via `REDIS_IDLE_PROBE_INTERVAL` which defaults to 0. // When set to zero, aliveness is not checked. IdleProbeInterval time.Duration `env:"REDIS_IDLE_PROBE_INTERVAL,default=0s"` // Wait when true and the pool is at the MaxActiveConns limit, calls to Get() // wait for a connection to be returned to the pool before returning. Wait bool `env:"REDIS_WAIT,default=false"` // AttachmentNames is an optional configuration which allows to set up // connection pools to each redis attachment using the Pools() function. The // same configuration parameters apply for each pool, except the URL which is // extracted from the environment based on the attachment name. AttachmentNames []string `env:"REDIS_ATTACHMENT_NAMES"` }
Config stores all the basic redis pool configuration knobs.
Click to show internal directories.
Click to hide internal directories.