PSUBSCRIBE

Syntax
PSUBSCRIBE pattern [pattern ...]
Available since:
2.0.0
Time complexity:
O(N) where N is the number of patterns to subscribe to.
ACL categories:
@pubsub, @slow,

订阅客户端到给定的模式。

支持的全局样式模式:

  • h?llo 订阅了 hello, hallohxllo
  • h*llo 订阅了 hlloheeeello
  • h[ae]llo 订阅了 hellohallo, 但不包括 hillo

如果你想逐字匹配特殊字符,请使用\来转义它们。

一旦客户端进入订阅状态,除了额外的SUBSCRIBESSUBSCRIBEPSUBSCRIBEUNSUBSCRIBESUNSUBSCRIBEPUNSUBSCRIBEPINGRESETQUIT命令外,客户端不应发出任何其他命令。 然而,如果使用RESP3(参见HELLO),客户端在订阅状态下可以发出任何命令。

欲了解更多信息,请参阅Pub/sub

行为变更历史

  • >= 6.2.0: RESET 可以被调用来退出订阅状态。

RESP2/RESP3 回复

When successful, this command doesn't return anything. Instead, for each pattern, one message with the first element being the string psubscribe is pushed as a confirmation that the command succeeded.
RATE THIS PAGE
Back to top ↑