aboutsummaryrefslogtreecommitdiff
path: root/internal/db/redis/redis.go
blob: f9147be1f2fc14d18186ce6ef123395421eecfc5 (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"

	"go.ofmax.li/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) },
	}
}