diff options
author | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2010-09-20 00:36:09 +0400 |
---|---|---|
committer | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2010-09-20 00:36:09 +0400 |
commit | c26621e9cb7d7a89d5fd7c963cae0d5b669c989e (patch) | |
tree | e5c0f765177c97cc83ecbcf708b9d4c1b0a06407 | |
parent | 91256dffabf8eed6e16e78b83898b1232afc2c96 (diff) |
Doc for PUB/SUB.2.0.0
-rw-r--r-- | README.markdown | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 67e6849d..049ad38d 100644 --- a/README.markdown +++ b/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. |