redisutil

package
v0.0.0-...-948e253 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Pool redis 连接池, 直接从连接池中获取可用连接
	Pool *redis.Pool
)

Functions

func NewRedisPool

func NewRedisPool(_cfg *RedisConfig) error

NewRedisPool 初始化redis 连接池

Types

type RedisConfig

type RedisConfig struct {
	//Addr reids host:port
	Addr string `toml:"addr"`
	//DB use db
	DB string `toml:"db"`
	// Password auth need
	Password string `toml:"password"`
	// MaxActive max active connection
	MaxActive int `toml:"max_active"`
	// MaxIdle max idle connection
	MaxIdle int `toml:"max_idle"`
	// ConnLifeTime
	ConnLifeTime int `toml:"conn_life_time"`
	// IdleTimeout
	IdleTimeout    time.Duration `toml:"idle_timeout"`
	ConnectTimeout time.Duration `toml:"connect_timeout"`
	ReadTimeout    time.Duration `toml:"read_timeout"`
	WriteTimeout   time.Duration `toml:"write_timeout"`
	// TLSEnable AWS ElastiCache若开启密码访问 则需要配置为true
	TLSEnable bool `toml:"tls_enable"`
	// TLSSkipVerify AWS ElastiCache若开启密码访问 可以选择是否跳过证书验证,默认true
	TLSSkipVerify bool `toml:"tls_skip_verify"`
}

RedisConfig redis 相关配置

Jump to

Keyboard shortcuts

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