Created
October 24, 2014 14:18
-
-
Save g-dormoy/af171b5171f17c7fdb81 to your computer and use it in GitHub Desktop.
return a pool of 50 redis connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/garyburd/redigo/redis" | |
func GetRedisConnection() (*redis.Pool, error) { | |
connPool := redis.NewPool(func() (redis.Conn, error) { | |
conn, err := redis.Dial("tcp", "redis.host:6379") | |
if err != nil { | |
return nil, err | |
} | |
return conn, err | |
}, 50) | |
return connPool, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment