Skip to content
Open
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
10 changes: 10 additions & 0 deletions redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,13 @@ func NewClient(options Options) (Client, error) {

return result, nil
}

// NewWithClient method creates a new `gokv.redis.Client` with given `redis.Client`.
// redis related options are ignored, only Codec is applicable
// The client is expected to be fully configured, with an address of a Redis server/cluster etc.
func NewWithClient(rc *redis.Client, options Options) *Client {
if options.Codec == nil {
options.Codec = DefaultOptions.Codec
}
return &Client{c: rc, codec: options.Codec}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NewClient currently includes a Ping call to check/establish a connection. Maybe we can do the same here, to minimize NewClient vs NewWithClient differences?

}