Added support for Redis PubSub:
authorPedro Melo <melo@simplicidade.org>
Sat, 7 Aug 2010 12:07:26 +0000 (13:07 +0100)
committerPedro Melo <melo@simplicidade.org>
Sat, 7 Aug 2010 12:26:48 +0000 (13:26 +0100)
commit56197d6df0962e44fdc7a2d5e4018c7900083087
tree1abc4d255ab4a601e98181643efb5616b4ee7dd4
parent3e839770e8b534a3394b02e579c90fbf37de97c7
Added support for Redis PubSub:

 * support commands SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, and PUNSUBSCRIBE:
   * PUBLISH is a regular Redis command, already supported.
 * last argument of subscription changes commands must be a callback, a
   coderef:
   * for each message, the callback will be called with three parameters:
     * the messages data;
     * the topic to whom the message was sent;
     * the subscription that catched this message.
 * you can subscribe to multiple topics or topic matches with the same
   callback: messages to any of those topics will invoke the callback;
 * you can call p?subscribe() multiple times with the same topics or
   topic matching rules, and with different callbacks:
   * we will manage a single Redis subscription, and call all the
     callbacks per message received.
 * p?unsubscribe() calls require the original callback, to remove the
   correct subscription.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Makefile.PL
lib/Redis.pm
t/03-pubsub.t [new file with mode: 0644]