27 lines
407 B
Go
27 lines
407 B
Go
package redis
|
|
|
|
import (
|
|
"github.com/gomodule/redigo/redis"
|
|
)
|
|
|
|
var Pool *redis.Pool
|
|
|
|
func InitPackage() {
|
|
go func() {
|
|
Pool = &redis.Pool{
|
|
MaxIdle: 1,
|
|
MaxActive: 3,
|
|
IdleTimeout: 240,
|
|
Wait: true,
|
|
MaxConnLifetime: 1,
|
|
Dial: func() (redis.Conn, error) {
|
|
return redis.Dial("tcp", "192.168.1.50:6379")
|
|
},
|
|
}
|
|
}()
|
|
}
|
|
|
|
func DestroyPackage() {
|
|
Pool.Close()
|
|
}
|