-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting client name with paramater in connection string #2312
Comments
func ExampleParseURL() {
opt, err := redis.ParseURL("redis://:qwerty@localhost:6379/1?dial_timeout=5s")
if err != nil {
panic(err)
}
fmt.Println("addr is", opt.Addr)
fmt.Println("db is", opt.DB)
fmt.Println("password is", opt.Password)
fmt.Println("dial timeout is", opt.DialTimeout)
// Create client as usually.
_ = redis.NewClient(opt)
// Output: addr is localhost:6379
// db is 1
// password is qwerty
// dial timeout is 5s
}
func ParseURL(redisURL string) (*Options, error) {
u, err := url.Parse(redisURL)
if err != nil {
return nil, err
}
switch u.Scheme {
case "redis", "rediss":
return setupTCPConn(u)
case "unix":
return setupUnixConn(u)
default:
return nil, fmt.Errorf("redis: invalid URL scheme: %s", u.Scheme)
}
} |
@monkey92t could you elaborate what you mean with this example ? |
Oh, sorry, I misread your issue... please forgive me😁... Redis ClientName https://redis.io/commands/client-setname/ is the name of the network connection, so it doesn't make sense for go-redis... |
Why does it not make sense? I'd like to be able to see the list of clients, connected to redis using An ideal solution would be to allow to specify client name in |
looks great |
Expected Behavior
Connection string should allow setting the client name as the C# client does (see ClientName).
Current Behavior
go-redis does not allow client name in connection string.
Possible Solution
The text was updated successfully, but these errors were encountered: