PUNSUBSCRIBE(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– 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 🌈

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