Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Addrs []string `envconfig:"REDIS_ADDRS"` // Database to be selected after connecting to the server. // Only single-node and failover clients. DB int `envconfig:"REDIS_DB"` Username string `envconfig:"REDIS_USERNAME"` Password string `envconfig:"REDIS_PASSWORD"` MaxRetries int `envconfig:"REDIS_MAX_RETRIES" default:"3"` MinRetryBackoff time.Duration `envconfig:"REDIS_MIN_RETRY_BACKOFF" default:"5s"` MaxRetryBackoff time.Duration `envconfig:"REDIS_MAX_RETRY_BACKOFF" default:"30s"` DialTimeout time.Duration `envconfig:"REDIS_DIAL_TIMEOUT" default:"30s"` ReadTimeout time.Duration `envconfig:"REDIS_READ_TIMEOUT" default:"30s"` WriteTimeout time.Duration `envconfig:"REDIS_WRITE_TIMEOUT" default:"30s"` PoolSize int `envconfig:"REDIS_POOL_SIZE"` MinIdleConns int `envconfig:"REDIS_MIN_IDLE_CONNS"` MaxConnAge time.Duration `envconfig:"REDIS_MAX_CONN_AGE"` PoolTimeout time.Duration `envconfig:"REDIS_POOL_TIMEOUT"` IdleTimeout time.Duration `envconfig:"REDIS_IDLE_TIMEOUT"` IdleCheckFrequency time.Duration `envconfig:"REDIS_IDLE_CHECK_FREQUENCY"` MaxRedirects int `envconfig:"REDIS_MAX_REDIRECTS"` ReadOnly bool `envconfig:"REDIS_READ_ONLY"` RouteByLatency bool `envconfig:"REDIS_ROUTE_BY_LATENCY"` RouteRandomly bool `envconfig:"REDIS_ROUTE_RANDOMLY"` // The sentinel master name. // Only failover clients. MasterName string `envconfig:"REDIS_MASTER_NAME"` }
Config holds Redis cache configuration.
func ReadConfigFromEnv ¶ added in v0.1.7
func ReadConfigFromEnv(opts ...config.ReadOption) Config
ReadConfigFromEnv read Redis configuration from environment variables.
type Option ¶
type Option func(*Redis)
Option is Redis configuration option.
func FromConfig ¶
FromConfig is an option to configure the Redis cache from a custom config.
func FromEnv ¶
func FromEnv(opts ...config.ReadOption) Option
FromEnv is an option to configure the Redis cache from environment variables.
func FromUniversalOptions ¶
func FromUniversalOptions(opts *redis.UniversalOptions) Option
FromUniversalOptions is an option to configure Redis cache from the given options.
Click to show internal directories.
Click to hide internal directories.