PSUBSCRIBE(3valkey)
π PSUBSCRIBE β the valkey manual page, but make it cute π
okay so bestie, welcome to PSUBSCRIBE(3valkey), the valkey command that's literally just vibes-based listening. instead of following one specific channel like a normal person, you follow patterns, and valkey hits you up whenever anything matching slides into the chat. it's giving "i don't know who's gonna text me but i'll know when they do" energy. β¨
πΈ NAME πΈ
psubscribe β listens for messages published to channels that match one or more patterns. no cap, that's the whole job description. π
π¦ SYNOPSIS π¦
PSUBSCRIBE pattern [pattern...]
π DESCRIPTION π
so basically, PSUBSCRIBE subscribes the client to the given patterns. that's it, that's the tea. π«
here are the glob-style patterns it supports, and yes they're iconic:
h?llosubscribes tohello,halloandhxlloh*llosubscribes tohlloandheeeelloh[ae]llosubscribes tohelloandhallo, but nothillo
use \ to escape special characters if you want to match them verbatim. periodt. π
β οΈ once the client enters the subscribed state it is not supposed to issue any other commands, except for these lil guys: additional valkey-subscribe(7)SUBSCRIBE, valkey-ssubscribe(7)SSUBSCRIBE,PSUBSCRIBE, valkey-unsubscribe(7)UNSUBSCRIBE, valkey-sunsubscribe(7)SUNSUBSCRIBE, valkey-punsubscribe(7)PUNSUBSCRIBE, valkey-ping(7)PING, valkey-reset(7)RESETand valkey-quit(7)QUITcommands.
however, if RESP3 is used (see valkey-hello(7) HELLO) it is possible for a client to issue any commands while in subscribed state. main character privilege unlocked fr fr π
note that valkey-reset(7) RESET can be called to exit subscribed state. the escape hatch, the exit interview, the "i'm leaving the group chat" button. πͺ
for more information, see valkey-pubsub(7) Pub/sub. iykyk. π
β¨ REPLY β¨
when successful, this command doesn't return anything. like, nothing at all. instead, for each pattern, one message with the first element being the string psubscribe is pushed as a confirmation that the command succeeded. so you don't get an answer, you get notifications. so demure of it. π
π₯ COMPLEXITY π₯
O(N) where N is the number of patterns to subscribe to. so like, the more patterns you collect, the more work it does. don't be greedy bestie. π
π ACL CATEGORIES π
@pubsub @slow
π HISTORY π
- Available since: 2.0.0 β a legend, an elder, a founding mother. she's been here since the beginning and she ate. π
π SEE ALSO π
- publish(3valkey)
- pubsub(3valkey)
- pubsub-channels(3valkey)
- pubsub-help(3valkey)
- pubsub-numpat(3valkey)
- pubsub-numsub(3valkey)
- pubsub-shardchannels(3valkey)
- pubsub-shardnumsub(3valkey)
- punsubscribe(3valkey)
- spublish(3valkey)
- ssubscribe(3valkey)
- subscribe(3valkey)
- sunsubscribe(3valkey)
- unsubscribe(3valkey)
the whole friend group. the squad. go say hi. π«Ά
okay that's the whole page, bestie, you're officially subscribed (to knowledge). this gorgeous piece of documentation is from version 9.0.0, dated 2025-10-21, and it lives in PSUBSCRIBE(3valkey). slay, stay subscribed, and remember: patterns are just friendship with wildcards. πβ¨π¦πΈπ
π¦ 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