mirror of
https://github.com/elyby/chrly.git
synced 2025-01-09 21:37:55 +05:30
24 lines
476 B
Go
24 lines
476 B
Go
|
package redis
|
||
|
|
||
|
import (
|
||
|
"elyby/minecraft-skinsystem/model"
|
||
|
|
||
|
"github.com/mediocregopher/radix.v2/pool"
|
||
|
)
|
||
|
|
||
|
type Config struct {
|
||
|
Addr string
|
||
|
PollSize int
|
||
|
}
|
||
|
|
||
|
func (cfg *Config) CreateRepo() (model.SkinsRepository, error) {
|
||
|
conn, err := pool.New("tcp", cfg.Addr, cfg.PollSize)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
// TODO: здесь можно запустить горутину по восстановлению соединения
|
||
|
|
||
|
return &redisDb{conn: conn}, err
|
||
|
}
|