PUNSUBSCRIBE(3valkey)
π PUNSUBSCRIBE β the Valkey Command Manual, bestie edition π
okay so. you're in the 3valkey manual, you clicked on PUNSUBSCRIBE, and honestly? iconic choice. let's get into it.
β¨ NAME β¨
punsubscribe β stops listening to messages published to channels that match one or more patterns. it's the "okay bye i'm leaving the group chat" of Valkey commands π
πΈ SYNOPSIS πΈ
PUNSUBSCRIBE pattern [pattern...]
π¦ DESCRIPTION π¦
so basically: this unsubscribes the client from the patterns you hand it. and if you hand it none? it unsubscribes you from all of them. no cap, all of them.
When no patterns are specified, the client is unsubscribed from all the previously subscribed patterns. In this case, a message for every unsubscribed pattern will be sent to the client. π
like... every single one. and you get a lil receipt for each. we love a paper trail.
π REPLY π
When successful, this command doesn't return anything. Instead, for each pattern, one message with the first element being the string punsubscribe is pushed as a confirmation that the command succeeded. so it's not a return value situation, it's a pushed message situation. one per pattern. periodt. β¨
π§ COMPLEXITY π§
O(N) where N is the number of patterns to unsubscribe.
translation: the more patterns you're ditching, the more work it is. math is math, bestie.
π₯ ACL CATEGORIES π₯
@pubsub@slow
π HISTORY π
- Available since:
2.0.0
she's been around. a true veteran. main character energy since day one π«Ά
π SEE ALSO π
psubscribe(3valkey)publish(3valkey)pubsub(3valkey)pubsub-channels(3valkey)pubsub-help(3valkey)pubsub-numpat(3valkey)pubsub-numsub(3valkey)pubsub-shardchannels(3valkey)pubsub-shardnumsub(3valkey)spublish(3valkey)ssubscribe(3valkey)subscribe(3valkey)sunsubscribe(3valkey)unsubscribe(3valkey)
go read those too, iykyk π
heads up bestie: if you call PUNSUBSCRIBE with no patterns, you're nuking every pattern subscription you had. not a drill. it's fine, it's reversible, but it's thorough. π
and that's the whole page, no notes. this was PUNSUBSCRIBE from the Valkey Command Manual, version 9.0.0, dated 2025-10-21. thanks for coming to my ted talk, slay, drink water, unsub responsibly ππ
π¦ 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