Documentation ¶
Overview ¶
Package goredis is a library wrapped on top of github.com/go-redis/redis.
Index ¶
- Constants
- func Init(dsn string, opts ...Option) (*redis.Client, error)
- func Init2(addr string, password string, db int, opts ...Option) *redis.Client
- func InitCluster(addrs []string, username string, password string, opts ...Option) *redis.ClusterClient
- func InitSentinel(masterName string, addrs []string, username string, password string, ...) *redis.Client
- type Option
Constants ¶
View Source
const ( // ErrRedisNotFound not exist in redis ErrRedisNotFound = redis.Nil // DefaultRedisName default redis name DefaultRedisName = "default" )
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init connecting to redis dsn supported formats. (1) no password, no db: localhost:6379 (2) with password and db: <user>:<pass>@localhost:6379/2 (3) redis://default:123456@localhost:6379/0?max_retries=3 for more parameters see the redis source code for the setupConnParams function
Types ¶
type Option ¶
type Option func(*options)
Option set the redis options.
func WithDialTimeout ¶
WithDialTimeout set dail timeout
func WithReadTimeout ¶
WithReadTimeout set read timeout
func WithWriteTimeout ¶
WithWriteTimeout set write timeout
Click to show internal directories.
Click to hide internal directories.