Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion osscluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,11 @@ type ClusterClient struct {

// NewClusterClient returns a Redis Cluster client as described in
// https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec.
// Passing nil ClusterOptions will cause a panic.
func NewClusterClient(opt *ClusterOptions) *ClusterClient {
if opt == nil {
panic("redis: NewClusterClient nil options")
}
Comment thread
ndyakov marked this conversation as resolved.
opt.init()

c := &ClusterClient{
Expand Down Expand Up @@ -1190,7 +1194,8 @@ func NewClusterClient(opt *ClusterOptions) *ClusterClient {
return c
}

// Options returns read-only Options that were used to create the client.
// Options returns read-only *ClusterOptions that were used to create the client.
// Any alteration of the returned *ClusterOptions may result in undefined behaviour.
func (c *ClusterClient) Options() *ClusterOptions {
return c.opt
}
Expand Down
4 changes: 3 additions & 1 deletion redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@ type Client struct {
}

// NewClient returns a client to the Redis Server specified by Options.
// Passing nil Options will cause a panic.
func NewClient(opt *Options) *Client {
if opt == nil {
panic("redis: NewClient nil options")
Expand Down Expand Up @@ -1313,7 +1314,8 @@ func (c *Client) Process(ctx context.Context, cmd Cmder) error {
return err
}

// Options returns read-only Options that were used to create the client.
// Options returns read-only *Options that were used to create the client.
// Any alteration of the returned *Options may result in undefined behaviour.
func (c *Client) Options() *Options {
return c.opt
}
Expand Down
5 changes: 4 additions & 1 deletion ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ type Ring struct {
heartbeatCancelFn context.CancelFunc
}

// NewRing returns a Redis Ring client to the Redis Server specified by RingOptions.
// Passing nil RingOptions will cause a panic.
func NewRing(opt *RingOptions) *Ring {
if opt == nil {
panic("redis: NewRing nil options")
Expand Down Expand Up @@ -647,7 +649,8 @@ func (c *Ring) Process(ctx context.Context, cmd Cmder) error {
return err
}

// Options returns read-only Options that were used to create the client.
// Options returns read-only *RingOptions that were used to create the client.
// Any alteration of the returned *RingOptions may result in undefined behaviour.
func (c *Ring) Options() *RingOptions {
return c.opt
}
Expand Down
4 changes: 4 additions & 0 deletions sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ func setupFailoverConnParams(u *url.URL, o *FailoverOptions) (*FailoverOptions,
// NewFailoverClient returns a Redis client that uses Redis Sentinel
// for automatic failover. It's safe for concurrent use by multiple
// goroutines.
// Passing nil FailoverOptions will cause a panic.
func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
if failoverOpt == nil {
panic("redis: NewFailoverClient nil options")
Expand Down Expand Up @@ -610,6 +611,8 @@ type SentinelClient struct {
*baseClient
}

// NewSentinelClient returns a Redis Sentinel client.
// Passing nil Options will cause a panic.
func NewSentinelClient(opt *Options) *SentinelClient {
if opt == nil {
panic("redis: NewSentinelClient nil options")
Expand Down Expand Up @@ -1182,6 +1185,7 @@ func contains(slice []string, str string) bool {

// NewFailoverClusterClient returns a client that supports routing read-only commands
// to a replica node.
// Passing nil FailoverOptions will cause a panic.
func NewFailoverClusterClient(failoverOpt *FailoverOptions) *ClusterClient {
if failoverOpt == nil {
panic("redis: NewFailoverClusterClient nil options")
Expand Down
2 changes: 2 additions & 0 deletions universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ var (
// 3. If the number of Addrs is two or more, or IsClusterMode option is specified,
// a ClusterClient is returned.
// 4. Otherwise, a single-node Client is returned.
//
// Passing nil UniversalOptions will cause a panic.
func NewUniversalClient(opts *UniversalOptions) UniversalClient {
if opts == nil {
panic("redis: NewUniversalClient nil options")
Expand Down
Loading