CLIENT-SETNAME(3valkey)
β¨ CLIENT-SETNAME β¨
okay bestie, welcome to the valkey command manual, CLIENT-SETNAME edition π this one's short, sweet, and lowkey iconic.
πΈ NAME πΈ
client-setname β gives your connection a little name tag π
π¦ SYNOPSIS π¦
CLIENT SETNAME connection-name
π DESCRIPTION π
So basically, CLIENT SETNAME slaps a name onto the current connection. That's it. That's the whole job. π
And why do we care? Because that name you just gave it shows up in the output of valkey-client-list(7) CLIENT LIST β so now you can actually tell which client did a thing on a given connection. no more mystery connections, we love to see it π₯
fr fr, picture this: you're using Valkey to implement a queue, and your producers and consumers both want to announce their whole role in life by naming their connection accordingly. now they can. main character energy for every connection π
Now for the deets:
- There's no limit to how long the name can be β beyond the usual limits of the String type, that's 512 MB. go off, write a novel, we support you π
- BUT you can't use spaces in a connection name, because that would violate the format of the
CLIENT LISTreply. sorry babe, no spaces. π - You can completely remove the connection name by setting it to the empty string β and fun fact, the empty string is not a valid connection name, precisely because it serves this one specific purpose. it's the "no name" name π«Ά
- Wanna peek at what the name currently is? Use
valkey-client-getname(7)CLIENT GETNAME. π - Every brand-new connection starts out with no assigned name. fresh start, no baggage β¨
π‘ Tip: naming your connections is a genuinely great way to debug connection leaks caused by bugs in the application using Valkey. yes bestie, name them and catch the leaky ones π
π REPLY π
valkey-protocol(7) Simple string reply: OK if the connection name was successfully set. π
β COMPLEXITY β
O(1) β constant time, instant, no thoughts required, we love efficiency π«
π ACL CATEGORIES π
@connection @slow
π¦ HISTORY π¦
- Available since: 2.6.9
π SEE ALSO π
auth(3valkey)client(3valkey)client-caching(3valkey)client-capa(3valkey)client-getname(3valkey)client-getredir(3valkey)client-help(3valkey)client-id(3valkey)client-import-source(3valkey)client-info(3valkey)client-kill(3valkey)client-list(3valkey)client-no-evict(3valkey)client-no-touch(3valkey)client-pause(3valkey)client-reply(3valkey)client-setinfo(3valkey)client-tracking(3valkey)client-trackinginfo(3valkey)client-unblock(3valkey)client-unpause(3valkey)echo(3valkey)hello(3valkey)ping(3valkey)quit(3valkey)reset(3valkey)select(3valkey)
and that's a wrap, bestie π«Ά this page is from Valkey 9.0.0, dated 2025-10-21. go name those connections, you absolute legend πβ¨
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms