- redis ์ฝ๋ ์ด์ด๋ณด๊ธฐ
type Options struct {
Network string
Addr string
Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
OnConnect func(*Conn) error
Password string
DB int
MaxRetries int
MinRetryBackoff time.Duration
MaxRetryBackoff time.Duration
DialTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
MinIdleConns int
MaxConnAge time.Duration
PoolTimeout time.Duration
IdleTimeout time.Duration
IdleCheckFrequency time.Duration
readOnly bool
TLSConfig *tls.Config
Limiter Limiter
}
- Network
- Network ํ์
์ ์ ํด์ค ์ ์๋ค.
- Default ๊ฐ์ tcp๋ก ์ค์ ๋์ด ์๋ค.
- Addr
- Dialer
- ์๋ก์ด network connection์ ๋ง๋ ๋ค.
- network ์ addr ์ต์
์ ์ ํด์ค ์ ์๋ค.
- OnConnect
- Password
- DB
- ์๋ฒ์ ์ฐ๊ฒฐํ ๋ฐ์ดํฐ ์ ํ.
- Redis๋ 16๊ฐ์ DB๋ฅผ ์ ๊ณต. (0~15)
- MaxRetries
- ๋ช ๋ฒ retry๋ฅผ ์๋ํ ๊ฒ์ธ์ง ์ต๋ ํ์๋ฅผ ์ ํ๋ค.
- Default ๋ก๋ ์คํจ์ retry ๋ฅผ ์๋ ํ์ง ์๋๋ก ์ค์ ๋์ด ์๋ค.
- MinRetryBackoff
- Default : 8 milliseconds
- Disable ํ๋ ค๋ฉด ๊ฐ์ -1 ๋ก ์ค์ .
- MaxRetryBackoff
- Default: 512 milliseconds
- Disable ํ๋ ค๋ฉด ๊ฐ์ -1 ๋ก ์ค์ .
- DialTimeout
- ์ connection ์ Dial timeout ์ค์ .
- ๋จ์๋ ์ด
- Default : 5 s
- ReadTimeout
- Timeout for socket reads.
- Timeout์ ๋๋ฌํ๊ฒ ๋๋ฉด blocking ๋๋ ๋์ ๋ช
๋ น๋ค์ ์คํจ๋ก ์ข
๊ฒฐ๋๋ค.
- Default : 3 s
- Disable : -1
- WriteTimeout
- Timeout for socket writes.
- Timeout์ ๋๋ฌํ๊ฒ ๋๋ฉด blocking ๋๋ ๋์ ๋ช
๋ น๋ค์ ์คํจ๋ก ์ข
๊ฒฐ๋๋ค.
- Default : ReadTimeout
- PoolSize
- socket connections์ ์ต๋ ๊ฐ์
- MinIdelConns
- new connection ์ด ๋๋ฆด๋ ์ ์ฉํ๊ฒ ์ฌ์ฉ๋๋ค.
- MaxConnAge
- Default : aged connections ๋ฅผ ๋ซ์ง ์๋๋ค.
- PoolTimeout
- ๋ชจ๋ Connections ์ด busy ์ผ ๊ฒฝ์ฐ error๋ฅผ ๋ฐ๋ก ๋ฆฌํดํ๊ธฐ ์ ์ client์๊ฒ ์ฃผ๋ ๋๊ธฐ์๊ฐ.
- Default : ReadTimeout + 1 s
- IdleTimeout
- Default : 5 min
- Disable : -1
- IdleCheckFrequency
- Default : 1 min
- Disable : -1
- readOnly
- slave nodes์ read only ์ฟผ๋ฆฌ ์ค์ (on/off)
- TLSConfig
- Limiter
โ return to TOC