标签:dia har fun out timeout imp get style tcp
1.代码实现
package main import ( "fmt" "github.com/gomodule/redigo/redis" ) var pool *redis.Pool; func init(){ pool = &redis.Pool{ MaxIdle: 8, MaxActive:0, IdleTimeout: 100, Dial: func() (redis.Conn, error) { return redis.Dial("tcp","localhost:6379") }, } } func main(){ conn := pool.Get(); conn.Do("set","name","lisoi"); s, err := redis.String(conn.Do("get","name")); if err !=nil { fmt.Println("is error"); } fmt.Println(s); }
标签:dia har fun out timeout imp get style tcp
原文地址:https://www.cnblogs.com/zh718594493/p/14199667.html