Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Doc for PUB/SUB.

  • Loading branch information...
commit c26621e9cb7d7a89d5fd7c963cae0d5b669c989e 1 parent 91256df
@nicolasff nicolasff authored
Showing with 40 additions and 0 deletions.
  1. +40 −0 README.markdown
View
40 README.markdown
@@ -184,6 +184,46 @@ $ret = FALSE if x has been modified between the call to WATCH and the call to EX
*/
</pre>
+## subscribe
+##### Description
+Subscribe to channels. Warning: this function will probably change in the future.
+##### Parameters
+*channels*: an array of channels to subscribe to
+*callback*: either a string or an array($instance, 'method_name'). The callback function receives 3 parameters: the redis instance, the channel name, and the message.
+##### Example
+<pre>
+function f($redis, $chan, $msg) {
+ switch($chan) {
+ case 'chan-1':
+ ...
+ break;
+
+ case 'chan-2':
+ ...
+ break;
+
+ case 'chan-2':
+ ...
+ break;
+ }
+}
+
+$redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
+</pre>
+
+
+## publish
+##### Description
+Publish messages to channels. Warning: this function will probably change in the future.
+##### Parameters
+*channel*: a channel to publish to
+*messsage*: string
+##### Example
+<pre>
+$redis->publish('chan-1', 'hello, world!'); // send message.
+</pre>
+
+
## exists
##### Description
Verify if the specified key exists.
Please sign in to comment.
Something went wrong with that request. Please try again.