aboutsummaryrefslogtreecommitdiff
path: root/internal/db/redis/redis.go
blob: d769bb4d591e448ac6753dee2562b5b4b66242c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package redis

import (
	"time"

	"github.com/gomodule/redigo/redis"

	"gitlab.com/grumps/environ"
)

var redisServer = environ.GetEnv("AUTH_REDIS", "localhost:6379")

// CreatePool redis connection pool
func CreatePool(addr string) *redis.Pool {
	return &redis.Pool{
		MaxIdle:     3,
		IdleTimeout: 240 * time.Second,
		Dial:        func() (redis.Conn, error) { return redis.Dial("tcp", addr) },
	}
}