package redis import ( "git.loafle.net/commons/logging-go" occer "git.loafle.net/overflow/commons-go/config/external/redis" "github.com/gomodule/redigo/redis" ) var Pool *redis.Pool func InitPackage(config *occer.Redis) { if nil == config { return } Pool = &redis.Pool{ MaxIdle: 1, MaxActive: 3, IdleTimeout: 240, Wait: true, MaxConnLifetime: 1, Dial: func() (redis.Conn, error) { return redis.Dial(config.Network, config.Address) }, } logging.Logger().Infof("Redis: initialized [%s:%s]", config.Network, config.Address) } func StartPackage(config *occer.Redis) { if nil == config { return } } func StopPackage(config *occer.Redis) { if nil == config { return } } func DestroyPackage(config *occer.Redis) { if nil == config { return } Pool.Close() }