Provides common config and connect for Redis database.
type RedisConfig struct {
Host string
Port int
Database int
Password string
}
Port
is optional and defaults to the standard Redis port: 6379Database
in Redis is an integer.Password
is optional if using Redis in passwordless mode.
ConnectRedis(c RedisConfig) (*redis.Client, error)
Connect
will attempt to ping the Redis database for up to 5 seconds. If there is
no response after 5 seconds, then the function returns an error.